How to Insert a user defined variable inside Regular expression

HI,
I have a Variable which contains a string. I need to use this variable inside regular expression , so that it will search for that string in the text given as input

In the below screen shot, Input1 is the variable which has a string “abcd”. If i run this i am not able to find that string in my text file. I tried the syntax given in https://forum.uipath.com/t/variable-in-regex-pattern/136161 but it is not working for me.

reg

Please help

1 Like

Hi
Welcome to uipath community
The expression syntax is fine
But may I know what is the text string input and as you said the Input1 variable has value “abcd” which is going to be found from there
Cheers @gr2014

Hi Palani,
Thank you
I am using the string “abcdef is present in the string” as the input text.
I tried using writeline and also log message but all return nothing.
I am using Studio 10.0 beta90 , community edition

1 Like

Hmmm
This should work actually
I would like to see the output variable from that activity and how it is mentioned in the writeline or log message
Or we can directly use this regex expression if wanted in writeline or log mess

System.Text.RegularExpressions.Regex.Match(str_Input,”(?:abcd)”).ToString

Cheers @gr2014

1 Like

There was a problem, i was trying this Regex inside Regex builder. So it was unable to detect the variable. Now i tried the same in the Pattern (in properties), then it detected the variable and the Regex worked.

Thanks for all the help

4 Likes

Cheers @gr2014

1 Like

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