If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!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.HTML Code:/category/3/pictures45.html
With this regex I got to match the pagenumber.PHP Code:preg_match("/^\/category\/(?P<id>\d+)/", $url, $matches);
I figured I can combine both the regex and it should work but I can't get it to work.PHP Code:preg_match("/(?P<pagenumber>\d).html/", $url, $matches);
What am I doing wrong?PHP Code:preg_match("/^\/category\/(?P<id>\d+)(?P<pagenumber>\d).html/", $url, $matches);
Thanks guys
Video Script - The ultimate media site script
AutoVideoScript com - Run your own youtube sharing site
Try this
PHP Code:<?php
$url = '/category/3/pictures45.html';
preg_match('/\/category\/([0-9]+)\/([a-z]+)([0-9]+)/i', $url, $match);
echo('<pre>' . print_r($match, true) . '</pre>');
$id = $match[1];
$pagenumber = $match[3];
echo ('<p> ID = ' . $id . '</p>');
echo ('<p> Page number = ' . $pagenumber . '</p>');
?>
Desain.com
You are awesome. Thanks.
Video Script - The ultimate media site script
AutoVideoScript com - Run your own youtube sharing site
Bookmarks