How to extract specific string that starts with "72"?


Which Regex could be used for extracting the whole string which starts with “72”?
There are a few scenarios:

  1. There can be only number written (7230011274)
  2. Various strings can be before this number (811 / 7230011274)
    However, the number is always last in the row.

I really appreciate any help you can provide.

along with possible variations like closing ) or end of string

Which expression should I use?
I am trying with System.Text.RegularExpressions.Regex.Match(string, “/72\d+”) but it returns empty string?

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

System.Text.RegularExpressions.Regex.Match(string, "72\d+").Value



Thank you @ppr, I really appreciate your help!
Cheers! :beers:

@ppr , I forgot to mention that string can also contain “72” in the middle of some number:
8235720310 / 7235717482.

How can I write an expression to take string only if starts with 72?

you can try pattern with work boundaries:

so here we do fail

But as mentioned can extend to the end bound e.g.

1 Like

Great, thank you @ppr once again!

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