Get Multiple Lines between two strings Using Regex

Am trying to extract multiple lines of strings between two strings. The strings is :-
10 Current Residence Address ry5tryu, sjdwefdu, 54
dgergr, rgtre, fgtr
11 Current Residence County dfgregh
I want to extract y5tryu, sjdwefdu, 54
dgergr, rgtre, fgtr
I am trying to use the following RegEx expression (?=Current Residence Address ).*(?=11 Current Residence County).
It seems to be working in Regex website.

When am using it in UIpath Matches activity it is returning an empty collection.
can anyone tell me do I have to change some settings in the builder.

1 Like

The regex should be (?<=Current Residence Address )[\S\s]*(?=11 Current Residence County)
that is you want to retrieve what’s in between Current Residence Address and Current Residence County
Also, in the matches activity, check Advanced, not Literal.

Thanks. It works.

This expression would help you either
(?s)(?<=Current Residence Address)(.*?)(?=\d+\sCurrent)

Cheers @kshitijb

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