Reputation: 17
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 ?
Upvotes: 0
Views: 266
Reputation: 642
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:
http://rubular.com/r/g27NI0bHfI
Upvotes: 1