How to set execution sequence for Regex

Hello guys!

Is it possible to define a run sequence for regex in the same expression?

Example
I have the following expressions:

  • Expression 1: “(? <= ID : \ s) \ d +”
  • Expression 2: “(? <= ID : \ s * ID * \ s *) \ w +”

I put both expressions in the UiPath Matches activity “(? <= ID : \ s) \ d + | (? <= ID : \ s * ID * \ s *) \ w +”. By default, UiPath brings me the first one I find.

I need you to bring the first result according to my expression:

Evaluate all text with the expression “(? <= ID : \ s) \ d” and if you find nothing, search with the expression "(? <= ID : \ s * ID * \ s *) \ w + "

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(strData,"(?((?<=ID:\s)\d+)(?<=ID:\s)\d+|(?<=ID:\s*ID*\s*)\w+)").Value

BTW, I suppose the latter Expression2 should be "(?<=ID:\s*(ID)*\s*)\w+" ?

Regards,