How to use regular expression inside Assign VB expression

How can i use regular expression inside Assign activity VB expression? I’m trying to use something like this but it’s not working : arrayText(8).Split({","},StringSplitOptions.None)(1).Split({"^\d{5}$"},StringSplitOptions.None)(0)
I’m trying to split the State from Zip Code.

you want to extract TN 372803??
@aleksandra_sekulovsk

Hi,

Hope the following expression helps you.

System.Text.RegularExpressions.Regex.Match(strData,"(?<=[A-Z]{2}\s+)\d{5}").Value

Regards,

Hey @aleksandra_sekulovsk

Try using:
System.Text.RegularExpressions.Regex.Split(your_string, pattern)

I want to extract only TN.

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(strData,"[A-Z]{2}(?=\s+\d{5})").Value

regards,

Thank you very much your solution helped me.

1 Like

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