Regex Expression for

Hi All,

I am using Regex builder to get 0068Y00001Sn4P6QAJ from below expression .But when using in UiPath it gives Null value.

/lightning/r/Opportunity/0068Y00001Sn4P6QAJ/view

Hi @marina.dutta

Try this

(?<=Opportunity/)[\d\w]+

(?<=Opportunity\/).*(?=\/view)

Use this

Hi @marina.dutta

Check the below regular expression,

(?<=Opportunity\/)[\s\S]+(?=\/view)

Check the below workflow,

- Assign -> Input = "/lightning/r/Opportunity/0068Y00001Sn4P6QAJ/view"

- Assign -> output = System.Text.RegularExpressions.Regex.Match(Input.ToString, "(?<=Opportunity\/)[\s\S]+(?=\/view)").Value

Hope it helps!!

@lrtetala

In UiPath its throwing error.



In the expression you are passing the Output variable instead of that pass the variable which has the input data… @marina.dutta

Change here in the highlited variable in the below expression,
System.Text.RegularExpressions.Regex.Match(Input.ToString, “(?<=Opportunity/)[\s\S]+(?=/view)”).Value

Hope you understand!!

@mkankatala

Input string is nothing but what I am getting as output of get attribute href. This is my input string

Change the output variable scope to the outer most scope and try, may be you have create two output variables, delete one… @marina.dutta

@mkankatala

some issue with variable. I deleted and created new variable . It worked

1 Like

It’s my pleasure… @marina.dutta

Happy Automation!!

1 Like

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