Using sentence with Matches activity

Hi all

I’m using Matches activity to get a word between two sentences. All works fine if the LabelBefore and LabelAfter doesn’t have an space inside them (something like “textBefore” and “textAfter”). I need to assign this variables a text that have a space, something like LabelBefore = “spaced text 1” and LabelAfter=“Spaced text 2” but when I do this the Matches activity says that not match was found. How can I solve this?
And if there’s no value, how can get it “Matches Result” as null and not the error that it’s not declared?


Did you try checking “IgnorePatternWhiteSpace” in Regex Option?

Yes, it shows the same error :frowning:

Works for me. Is this you are trying to do? Try with default regex options only.

text : " text 1 helloworld text 2"

regex pattern : "(?<=text 1)(.*?)(?=text 2)"
options = RegexOptions.IgnorePatternWhitespace;
reWorks       = new Regex(@"(?<a>)", options);
reDoesNotWork = new Regex(@"( ?<a>)", options);

Hi all

I tried it but it doesn’t work. Maybe it’s because my text is like this:

Test example 1
THIS is the text

regex pattern : “(?<=Test example 1)(.*?)(?=is the text)”

It says that is not match. The following regex options are activaded:
Multiline, IgnoreCase, IgnorePatternWhiteSpace.
What can I do?



If any whitespace, you can add trim to your result.

It doesn’t work. Says that not match has found. What else can I do? :S

Matches.xaml (7.0 KB)

It works for two lines but i have a case that nees to take 3 lines. How can I do this?

Something that I can’t do is to get the data when the example is like this:

Test example 1
word before THIS the text

I want to get THIS but it doesn’t work. This is my pattern:

“(?<=Test example 1 word before)(.*?)(?=the text)”
Options: IgnoreCase, IgnorePatternWhiteSpace

What can I do?