Adding Multiple RegEx Expression in RegEx Builder?

Hi

I want to check something with you guys.

I want to try 2 Regex Expression in a given text like this

Now with this it doesn’t pick anything up.

If I just keep any 1 of them then it works fine. Together no.

I’m guessing I have to create 2 separate Matches activity?

Let me know.

Keep up the excellent work.

Regards
Davendra

Use one line and put your expressions in separate blocks like this

(1st regex expression)|(2nd regex expression)

The | operator will match either of the two regular expressions in parentheses.

2 Likes

mm… That didn’t work

(?:from\s*:|account\sname\s:|private\sand\sconfidential\s*-|partnership\sname:|beneficiary\scustomer\sname\s:)\s*([^\n]*)

notice\s*:[^\n]\n([^\n])\nDistribution\s*notice

becomes

((?:from\s*:|account\sname\s:|private\sand\sconfidential\s*-|partnership\sname:|beneficiary\scustomer\sname\s:)\s*([^\n])) | (notice\s:[^\n]\n([^\n])\nDistribution\s*notice)

Doesn’t work?

Hey @davendra

Surround them in brackets () and remove the ‘|’
Like this:
(1st regex expression)(2nd regex expression)

This will put the results into groups.

Then use the below expression with an ‘Assign’ activity if they need to be separated.

Group/Match 1:
INSERTVARIABLE(0).Groups(1).ToString
Group/Match 2:
INSERTVARIABLE(0).Groups(2).ToString

Replace capitals with your variable.

1 Like

I used match activity and kept (R1 ! R2) 2 regex experession .

And used for each to get my result .
In foreach I am getting 2 values in single item…
How can I assign into two variables