How to include a variable in Regex(matches) Pattern?

Hi,
I am trying to extract timespan, such as hours, after certain dates. These dates are results from another Matches Activity so they are stored in a variable, namely, DateVariable.

I’ve come up with the following Pattern but it doesn’t work. Can anyone help me figure out why and how to fix it?

Patterns:
(?<=((“+DateVariable+”).*))(\d{1,2}H)

Thanks in Advance.

4 Likes

You can try something like
New Regex(“(?<=”+DateVariable+“).*(\d{1,2}H)”).Match(test).Groups(1).Value

1 Like

check this :slight_smile:

1 Like

Thank you and sorry for not replied sooner(because of the time difference).
And also thanks to Divyashreem, I realized I made a silly mistake by putting a variable in the Regex builder instead of the pattern(property).
If put in property’s pattern, the variable can be recognized and problem solved.

1 Like

Thank you so much.I did made the same mistake. :sweat_smile: I wonder why I didn’t find this topic earlier, although I looked through a lot of topics before my post. :smile:

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