I have this string:
rf=hello&ur=bello&au=yello
However position changes randomly with each new line, e.g.
au=yello&rf=hello&ur=bello
What regular expression would be needed now to fetch all rf=(a-z)+ where au == yello?
I have this string:
rf=hello&ur=bello&au=yello
However position changes randomly with each new line, e.g.
au=yello&rf=hello&ur=bello
What regular expression would be needed now to fetch all rf=(a-z)+ where au == yello?
Using regex you can use:
(?=.*?(?:^|&)au=yello(?:&|$)).*?(?:^|&)rf=([^&]+)
Parameter rf
value is available in captured group #1.
Try this if group is not an option. (JS by example)
(rf=([a-z]+)(.+))*(au=yello)(.+)(rf=([a-z]+)(.+))*
it will check if rf=? is present before au=yello or if rf=? is present after.
Feel free to simplify parenthesis.