Matches Activity - Finds match but does not return it at runtime

Hi All
I am currently using the Matches activity to extract data from a large amount of text, so far it has worked fine. However I have come to a part that is highlighting the results in the Regex Builder but when I run it at runtime it comes back with no results.

As you can see below the NO at the end of the sentence "Is the above Plan Owner also Life assured ? No is selected.
Regex Expression - (?<=Is\sthe\sabove\sPlan\sOwner\salso\sLife\sAssured\W\s)(.*?\s(?=\s))

However when I run the code the result is empty
image

It really is a head scratcher .
I have attached the Workflow and the text file.
Any help would be greatly appreciated

PlanOwners.txt (2.8 KB) test.xaml (5.7 KB)

Hi,

It’s line break matter. In the wizard, linebreak is \n. However, in your text file, linebreak is \r\n.
So, can you try the following pattern?

"(?<=Is\sthe\sabove\sPlan\sOwner\salso\sLife\s+Assured\W\s)(.*?\s(?=\s))"

Regards,

1 Like

Hi Yoichi
Thanks so much that worked perfectly :slight_smile:
Kind Regards
Rachael

1 Like

May I quickly ask you @Yoichi another question .

I am trying to extract Address but I am not getting back the right values
Have used this expression but realise I need to put a line break in there but not sure where
(?<=Address\s)(.*?\s(?=\s))
Return
image

Thanks in advance
Rachael

Hi,

Do you want to get 2 lines after Address? If so, the following will work.

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Address\s).*\r?\n.*").Value

Regards,

1 Like

Thanks Yoichi , you save me so much time.
Your help has been greatly appreciated

Kind Regards
Rachael

1 Like

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