Regex Expression to keep out but still search for a certain expression


#1

I’m Trying to use matches to search for a number in a text file. I want the number after “Price of GasStation 3” which has a varying number of spaces after between 3 and the number I want. How can I display just the number in UIpath?
I’ve tried \K and look ahead and (?n) which uipath, ignores.
Thank you!


#2

Positive LookBehind should work. Keep in mind that Matches returns an enumerable, which might work in many situations. But you can also put in a Regex directly into an assign with: System.Text.RegularExpressions.Regex.Match(text, pattern).Value // or .Matches()

Using the lookbehind would look like this:
“(?<=(.*))[0-9]{1,2}$”

The $ tells it that it will be the end of a line, but you can also swap that out with (.*) probably