I am trying to match this uri. Also I want 3 to match as id and 45 in pictures45.html as pagenumber.
With this regex I got to match the category and id.
With this regex I got to match the pagenumber.
I figured I can combine both the regex and it should work but I can't get it to work.
What am I doing wrong?
Thanks guys
HTML:
/category/3/pictures45.html
With this regex I got to match the category and id.
PHP:
preg_match("/^\/category\/(?P<id>\d+)/", $url, $matches);
With this regex I got to match the pagenumber.
PHP:
preg_match("/(?P<pagenumber>\d).html/", $url, $matches);
I figured I can combine both the regex and it should work but I can't get it to work.
PHP:
preg_match("/^\/category\/(?P<id>\d+)(?P<pagenumber>\d).html/", $url, $matches);
What am I doing wrong?
Thanks guys




