I want to match the Following URLS to
http://deploy.local/user/12 => fnmatch(PATTERN???, $url);
http://deploy.local/user/tree => fnmatch(PATTERN???, $url);
But
fnmatch("user/[0-9]+" , $url);
does not work with these..
Any Suggestions ?
I want to match the Following URLS to
http://deploy.local/user/12 => fnmatch(PATTERN???, $url);
http://deploy.local/user/tree => fnmatch(PATTERN???, $url);
But
fnmatch("user/[0-9]+" , $url);
does not work with these..
Any Suggestions ?
Assuming that you meant by matching, you meant matching the whole URL, then the following regular expression should do the trick:
^https?:\/\/[a-zA-Z]+\.[a-zA-Z]+\/user\/[a-zA-Z0-9]+$
I also made you a permalink at rubular, containing the regex: