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 2 of 2
  1. #1
    Amms.com
    tristanperry's Avatar
    Join Date
    Jan 2007
    Location
    Wales, UK
    Posts
    1,684
    DNF$
    1,193
    Bank
    0
    Total DNF$
    1,193
    Donate  

    Troubles with a regular expression in PHP

    Hey all,
    I'm having a few troubles with a regular expression in PHP. Basically, the regular expression I'm using is:

    Code:
    preg_replace("@/{$cat}/{$cDesc}/\" title=\"(.+)\">(.+)</a></li>@","@/{$cat}/{$cDesc}/\" title=\"$1\">$2</a>". $output ."</li>@", $navBar);
    This would change, for example:

    Code:
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/14/ImperialGuard/" title="Fall in, soldier, and we will teach you how to fight for the Emperor!">Imperial Guard</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/15/ChaosSpaceMarines/" title="This section is for the ways of the Forces of Chaos.">Chaos Space Marines</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/16/DaemonHunters/" title="Discover how to better protect Humanity from the Daemonic Hordes!">Daemon Hunters</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/17/WitchHunters/" title="Discover how to seek out the Heretic, Mutant and Traitor.">Witch Hunters</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/18/Tyranids/" title="The Tyranids hunt their prey here.">Tyranids</a></li>
    into:

    Code:
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/14/ImperialGuard/" title="Fall in, soldier, and we will teach you how to fight for the Emperor!">Imperial Guard</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/15/ChaosSpaceMarines/" title="This section is for the ways of the Forces of Chaos.">Chaos Space Marines</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php@/16/DaemonHunters/" title="Discover how to better protect Humanity from the Daemonic Hordes!">Daemon Hunters</a><ul>
    
    <li title="This allows you to see only articles (in this categeory) of the selected type" class="SmallText">Filter Articles By:</li>
    <li class="SmallText"><a href="http://www.tauonline.org/TrialV7/Cat.php/16/DaemonHunters/House Rule" title="View only Daemon Hunters articles only of the type 'House Rule'">House Rule</a></li>
    <li class="SmallText"><a href="http://www.tauonline.org/TrialV7/Cat.php/16/DaemonHunters/Tactics" title="View only Daemon Hunters articles only of the type 'Tactics'">Tactics</a></li>
    </ul></li>@
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/17/WitchHunters/" title="Discover how to seek out the Heretic, Mutant and Traitor.">Witch Hunters</a></li>
    <li><a href="http://www.tauonline.org/TrialV7/Cat.php/18/Tyranids/" title="The Tyranids hunt their prey here.">Tyranids</a></li>
    As you can see, the "@" signs I'm using as delimiters in the reg. exp are being outputted - any ideas why, and how can I stop this?

    Thanks,
    Tristan

  2. #2
    Platinum Lifetime Member
    liberator's Avatar
    Join Date
    Jan 2007
    Location
    Canada
    Posts
    646
    Country

    Canada
    DNF$
    891
    Bank
    0
    Total DNF$
    891
    Donate  

    Re: Troubles with a regular expression in PHP

    you don't need to add the delimiter into the replace part this regular expression should work for you:

    Code:
    preg_replace("@/{$cat}/{$cDesc}/\" title=\"(.+)\">(.+)</a></li>@","/{$cat}/{$cDesc}/\" title=\"$1\">$2</a>". $output ."</li>", $navBar);
    Canadian Registrar ~~ Ready.ca

Similar Threads

  1. 14 Super PHP scripts, Ringtone site, and Photorating website!
    By NavySeals91 in forum DNF$ Sales/Domain Auctions
    Replies: 21
    Last Post: 07-06-2006, 07:09 PM
  2. PHP troubles with '
    By Borghunter in forum Coding/Programming/Languages
    Replies: 2
    Last Post: 05-06-2006, 03:48 PM
  3. Scripts 2 Sell Package on Auction
    By ForumsHelp in forum DNF$ Sales/Domain Auctions
    Replies: 15
    Last Post: 08-17-2005, 11:00 AM
  4. Beware of PHP! (& other ones :P )
    By PolurNET.com in forum Humor
    Replies: 13
    Last Post: 11-13-2004, 07:07 PM
  5. a nice one: mysqlphp.com
    By in forum Domain Name Appraisal Discussion
    Replies: 2
    Last Post: 04-27-2002, 04:29 PM

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