Regex returns "null" instead of a matched string

Hi, I need to extract a part of a string.

String = Invoice Total for Provider of Service MARC A SHOLES, L.C.S.W.
ExtractedString = MARC A SHOLES, L.C.S.W.

So, basically, “Invoice Total for Provider of Service” is static, and I have to extract everything after that.

I have used the expression,

So, In UiPath, I used - System.Text.RegularExpressions.Regex.Match(strProviderString,“/^Invoice Total for Provider of Service (.+)$/gm”).Value

But I’m not getting the expected value.
image

Please help!

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Invoice Total for Provider of Service ).+").Value

Regards,

1 Like

Thanks! It’s working.

1 Like

@manojj.yadav
Try this

1 Like

FYI, it’s better to set .NET(C#) at flavor in regex101. / is delimiter of regex for perl, PHP etc, however it’s unnecessary in .net(C# or VB) and as “gm” at the end of the string is regex option, it’s unnecessary to add to pattern.

Regards,

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