How to get only state id in a string

Hi All,

I need to extract only state id from a string and the position of stateID is dynamic.

Example: Eden Prairie MN 55344 In this string i want only State “MN” and The state position is dynamic for some countries its in second place and some its in 3rd position.

Can some one help me on this.



Share some probable sample strings, as you said it is dynamic

can you share some dynamic samples


  1. ASHBURN VA 20147
  2. NOIDA UP 201301
    3.Johnson City TN 37615


Please find attached xaml file with the solution,
I have tried for all the 3 example values you have provided and it worked fine.
Let me know if it does not work.

Don’t forget to click on MARK AS SOLUTION , if it works

GetOnlyState.xaml (7.7 KB)

1 Like

Hi @thima

Following is the regex used for any kind of String input it will give the output you want

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

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