How to extract from a large string only the part that starts with specific string

Hello,

I have multiple large strings that have in common a string that I need to extract and starts with “HTEL”.

So for example :

Case 1: String is : " My desired phone model is HTEL2203 and is out now. → I need to extract “HTEL2203”

Case 2: String is : " 123 HTEL445new" → I need to extract HTEL445new

Thanks in advance !

Regex could be one of more options:

Assign Activity:
strExtract =
System.Text.RegularExpressions.Regex.Match(yourText, "HTEL.*?\b").Value

It’s working perfectly but I forgot to add some details, actually I need to extract from the string all that starts with BE**HTEL where the * are dynamic numbers.

So I can have BE02HTEL, BE56HTEL and so on. Is there any way to achieve that with REGEX ?

** 2 digit length
grafik

UPD1 - any digit lenght:

It’s working!Thank you so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.