I think I have some misunderstanding about how a positive Lookbehind works in Regex, here is an example:
12,2 g this is fully random
89 g random string 2
0,6 oz random stuff
1 really random stuff
Let's say I want to match everything after the measuring unit, so I want "this is fully random", "random string 2", "random stuff" and really "random stuff".
In order to do that I tried the following pattern:
(?<=(\d(,\d)?) (g|oz)?).*
But as "?" means 0 or 1, it seems that the pattern prioritizes 0 over 1 in that case - So I get:
But the measuring unit has to stay "optional" as it won't necessary be in the string (cf fourth instance)...
Any idea on how to deal with that issue? Thanks!