Extract required text from a string variable


#1

I have a string variable that reads " Name person age address and A3>456>34356 is being processed." I want to extract “A3>456>34356” using regex or any other method. How can I do this?


#2

Hi @jamnanin,

If it is straight forward you can use replace method.

StrValue.Replace("Name person age address and ","")

Else
Use regex pattern to get the value

Pattern ([A-Z]*[0-9]*)>\w+
OR
([a-zA-Z][0-9]>[0-9]{3}>[0-9]{5})

Regards,
Arivu :slight_smile:


#3

Hi @jamnanin

myStr = StrValue.Split({" Name person age address and", “is being processed.”}, StringSplitOptions.None);

Cheers,
JGuarino