I have a problem with checking the URI. I would like to create a pattern that will accept such a URI:
?name=key&name=key
#anchor
foo?name=key&name=key
foo#anchor
foo/bar/*
foo/bar?name=key&name=key
foo/bar#anchor
At the moment I have something like this:
$path = 'foo';
$uri = 'foo/bar/bb';
preg_match('/^('.$path.'[^\w])[\/\w\S]+$/i', $uri);
// OR
preg_match('/^('.$path.'|'.$path.'(\?|#)[\w\S\=\.&%-]+)$/i', $uri);
I would like to simplify it somehow. Thank you in advance for your help.