Pass a Regex Match result into another regex activity

Hi, I´m using a regex activity to split a text when it finds the word IMEI and all the characters until reaching the tag
How do I pass that Regex result from the “Matches for IMEI” activity as an input for the “Matches to get IMEI”?
Thanks

image

Hi @Allison_Cruz

Matches activity require string inputs.

You need to save the 1st Matches output variable (which is of type ienumerable) to type string to pass it into the next Matches Activity.

To do this, refer to it like this “MatchesResult(0).tostring” to see what it captured.

I have made this demo workflow for you to copy/see. Main.xaml (5.8 KB)

Hopefully this helps :blush:

Cheers

Steve

Hi,

FYI, below is the supplement of @Steven_McKeering 's post.

If there is a possibility to contains regex special character in the match string, it’s better to use Regex.Escape as the following.

Str_input2 = System.Text.RegularExpressions.Regex.Escape(MatchesResult(0).Value)

For example, if match string from the first Matches activity is "$100", it should be "\$100" in pattern of the second Matches. as pattern "$100" doesn’t match "$100".

Regards,

2 Likes

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