Regular Expression to capture multiple line from sample text

Hi buddy,

I have problem in UiPath extracting string via regex.
Package System.Text.RegularExpressions = 4.3.1

regex string as below:


I tried both below regex testing tools.
This one seems meet the result I got in UiPath regex engine.
Results of PCRE, PCRE2 flavor are close to UiPath regex engine results, but not what I want.
.NET (C#) flavor is very close to my need although my regex string is not perfectly captured.

I’d like to know which regex engine is the one UiPath is using? (.NET? C#?)
And if I would like to get result of group “invoice_detail” like .NET (C#) flavor in, what can I do to modify the regex string?
Thanks for any advise.

Below are two possible sample text for Invoice number list
I’d like to capture all multiple line Invoice No. as a list of named capture group result “invoice_detail”, but only the first line could be captured.


INV NO: 800sdf-0052423


  1. try with regex options multiline and singleline
  2. check if the newline character is coming different in UiPath when read…for that open locals panel and check the value by clicking on magnifier may be new line is coming as \r\n generally to handle both cases \r?\n can be used


1 Like


Keep in mind that we would handle the Windows typically Linebreak composed by \r\n defensively by \r?\n

Quick n dirty

and would trim the result
strCatch = Regex.Match(strText, strPattern).Value.Trim

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

1 Like

Hi @Isaac_Yeh

Try by regexr -

(?<=INV NO:\s).*\s*.*\s*.*(?=\stest)

Hope it helps!!

Hi @Isaac_Yeh

Try this regex code:


Hope it helps!!

Hi @Anil_G

Thank you for the help. Use \r?\n DO fix my problem.

btw, for anyone who might encounter similar problem.
I checked my original text in HEX editor. It have 0x0d 0x0a in it.
I stuck in my missing of checking detail for around two days.

1 Like


Thank you for the information of UiPath regex engine flavor (.NET).
It saves my time for trying other flavors in next regex string. :slight_smile:

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