I have - let say - example.com website and there I have account page.
It may have GET parameters, which is also considered part of account page.
It also may have URL fragment. If it's home.html fragment - it is still the account page. And if another fragment - then it's a different sub-page of the account page.
So - I need a RegEx (JS) to match this case. This is what I managed to build so far:
example.com\/account\/(|.*\#home\.html|(\?(?!.*#.*)))$
https://regex101.com/r/ihjCIg/1
The first 4 are the cases I need. And as you see - the second row is not matched by my RegEx.
What am I missing here?
Third alternative in your group has a negative look ahead which ensures it rejects any text that contains a
#but you haven't specifically mentioned anything that should match rest of the content till end of line. Check this updated regex demo,https://regex101.com/r/ihjCIg/3
If you notice, I have escaped your first dot just before
comand have added.*after the negative look ahead part so it matches your second sample.