From any URL I want to extract its path.
For example:
URL: https://stackoverflow.com/questions/ask
Path: questions/ask
It shouldn’t be difficult:
url[/(?:\w{2,}\/).+/]
But I think I use a wrong pattern for ‘ignore this’ (‘?:’ – doesn’t work). What is the right way?
I would suggest you don’t do this with a regular expression, and instead use the built in URI lib:
It has a leading slash, but thats easy to deal with =)