Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

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!

Results 1 to 3 of 3
  1. #1
    Platinum Lifetime Member
    SGBoise's Avatar
    Join Date
    Jan 2008
    Location
    USA
    Posts
    41
    DNF$
    275
    Bank
    0
    Total DNF$
    275
    Donate  

    Can't get regex to match properly

    I am trying to match this uri. Also I want 3 to match as id and 45 in pictures45.html as pagenumber.
    HTML Code:
    /category/3/pictures45.html
    With this regex I got to match the category and id.
    PHP Code:
    preg_match("/^\/category\/(?P<id>\d+)/"$url$matches); 
    With this regex I got to match the pagenumber.
    PHP Code:
    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 Code:
    preg_match("/^\/category\/(?P<id>\d+)(?P<pagenumber>\d).html/"$url$matches); 
    What am I doing wrong?
    Thanks guys
    Video Script - The ultimate media site script
    AutoVideoScript com - Run your own youtube sharing site

  2. #2
    Platinum Lifetime Member
    xrvel's Avatar
    Join Date
    Nov 2007
    Location
    Xrvel.com
    Posts
    85
    Country

    Aaland Follow xrvel On Twitter
    DNF$
    587
    Bank
    0
    Total DNF$
    587
    Donate  
    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($matchtrue) . '</pre>');

    $id $match[1];
    $pagenumber $match[3];

    echo (
    '<p> ID = ' $id '</p>');
    echo (
    '<p> Page number = ' $pagenumber '</p>');
    ?>
    Desain.com

  3. #3
    Platinum Lifetime Member
    SGBoise's Avatar
    Join Date
    Jan 2008
    Location
    USA
    Posts
    41
    DNF$
    275
    Bank
    0
    Total DNF$
    275
    Donate  
    You are awesome. Thanks.
    Video Script - The ultimate media site script
    AutoVideoScript com - Run your own youtube sharing site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Domain name forum recommended by Domaining.com