While fully aware this is likely a duplicate, I simply cannot find a solution to this problem.
How to get a parameter anywhere it exist in a URL?
Consider these urls:
https://any.domain.com/uri-slug/random-string/specific-slug/?version='2'
https://any.domain.com/uri-slug/random-string/specific-slug/?paramOne=1&version=2
https://any.domain.com/uri-slug/random-string/specific-slug/?paramOne=1¶mTwo=2&version=2
I want to get version=2 out of these URLs.
This Regex will return true if version=2 starts the parameters, but not if it's after the first param.
https:\/\/(\w)+.domain.com\/(\w)+\/(\S)+\/specific-slug\/[?&]+(version=2)
How can I get version=2 to return true if it's present anywhere in the parameters?
/version=2/will return it if present in URL.version='?\d+will do the same. Additionally, which language do you use? If it is alwaysversion=2, you do not need a regex at all, so what is your question, really?specific-slug(also where the second\wis will have to be verified as well). After specific slug I need to know when version=2 is present and when it isn't. This is for tracking via hotjar.version=2will be the first param, other times it will be the last out of possibly four.