I am trying to get the URI segments using regular expression.
Example URI:
http://abc.com/hello/hi/bye?humm/ok=hi&ya=yaya/wow/waaah
^^^^^ ^^ ^^^ ^^^ ^^^^^
I am trying:
/(?<=\/)[\w-]+(?=(\/|$|\r|\?))/g
But it's not working properly. The query string is not getting excluded (wow/waaah
).
So, when I tried the following, everything got excluded:
/(?<!?.+)(?<=\/)[\w-]+(?=(\/|$|\r|\?))/g
What's wrong with this?