I need to create a regexp to match strings like this 999-123-222-…-22
The string can be finished by &Ns=(any number) or without this… So valid strings for me are
999-123-222-...-22
999-123-222-...-22&Ns=12
999-123-222-...-22&Ns=12
And following are not valid:
999-123-222-…-22&N=1
I have tried testing it several hours already… But did not manage to solve, really need some help
Not sure if you want to literally match
999-123-22-...-22or if that can be any sequence of numbers/dashes. Here are two different regexes:The key idea is the
(&Ns=\d+)?$part, which matches an optional&Ns=<digits>, and is anchored to the end of the string with$.