How can I use this Regex with lookbehind

Hello I have a large string. Now I want to get everything after ("of "+two digit number) or ("of "+three digit number). I tried:
(?<=of \b[0-9]{2,3}\b)(?s).*$
But it gives me an error: A quantifier inside a lookbehind makes it non-fixed width

Examples:
“of 22 cat dog” -> it should get " cat dog"
“of 457 cat dog” -> it should get " cat dog" as well

With a bit of fiddling around on regexr.com I found that the following worked:
(?<=of \d{2,3}\b).*$
Your expression also seems to work provided the (?s) mode modifier is removed.

1 Like

Thank you. I first tried on Regex101 and there it shows a pattern error but it seems to work in UiPath :slight_smile:

Yeah, for me too in UiPath. It seems that Regex101 and regexr don’t enforce the same implementation of regex as UiPath. Glad you got it working :slight_smile:

2 Likes

@Foehl I saved it in the link: https://regex101.com/r/7vfHvb/1/
On the right side it says “pattern error” “A quantifier inside a lookbehind makes it non-fixed width”
But if it works in UiPath there is no problem :wink:

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