Regex \d failing in UiPath Studio

I am able to build the regex just fine on websites like but not getting any matches within studio.

Code: (?<=Delito Pena Principal Pena\s\s\d ).+



Tried both .matches() and Matches activity.

I know some regex just dont “transfer correctly”, like how I need to use \s instead of \n for newlines in studio. From looking online there seems to be plenty of people with similar issues since 2020.

How can I solve this?
Isn’t there a resource from UiPath explaining this?

  • Thanks


Hi @rpadev77 ,

Maybe you could check with the below Regex :

(?<=Delito Pena Principal Pena\s+\d\s).+

Great that worked.
Can you explain the disconnect? Was UiPath automatically removing a line?

@rpadev77 ,

Noticed you have used \s\s - This accounts for two spaces only, whereas we have a newline (2) present in the data.

The newline can also be replicated by \s+ - One or more number of spaces, Hence the replacement.

However, Even with your regex, I was able to get the output. Could you let us know what was the configuration in Matches Activity if you have used it ? Was it done like below :

Was the Multiline option selected ?

Ah no I didnt have the Multiline option. I saw the 2 lines when pasting the output but not in the output itself. I’ll uttilize the properties panel or regex.matches.() instead of the Config Wizard here on out.

I cant seem to get \n to recognize newlines in UiPath and have been using /s as a workaround. I see how /s**+** quantifier was need since \s is for spaces.

Would you recommend a better way to identify newlines in studio (\n doesnt seem to work and I dont have a specific use case atm) or stick to \s+

@rpadev77 ,

It is sometimes a carriage return as well, so we use options - \r?\n, \r\n, \r?\n?

1 Like

I see…
\s for spaces
\n for newlines
\r for carridge returns

with a combination of quantifiers:
? zero or one

  • as many as possible

Thank you for the help. :man_bowing:

(“plus sign”) as many as possible

Hello @rpadev77

Sounds like you are on the right path and have a solution from the great @supermanPunch

The only thing I would add is, if you are having trouble with ’new lines’ in regex than try adding this: [\r\n]+

Feel free to take a look at my Regex MegaPost (if you haven’t seen it already)



1 Like

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