I currently have a regex to match a url subpath. It looks like this
^(?!^__.*__$).[a-zA-Z0-9_.-]+$
I want to disable ONLY 2 underscores at the beginning and the end of the string because it's a reserved string. Any number of underscores other than 2 should be allowed
For example:
_should_work_
__should_work___
_should_work___
__should_not_work__
The problem now is even though I have more than 2 underscores, the regex will still not match
___should_work_but_doesnt__________
You can check out the regex here: