It appears you have not yet registered with our community. To register please click here...

DNforum.com - Domain Sales, Domain Forum, Domain Appraisals
 
Register Now!
Register Now for FREE!
Our records show you have not yet registered to our forums. To sign up for your FREE account INSTANTLY fill out the form below!

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:  
Birthday:       I agree to forum rules 

Go Back   DNForum - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars > Content Development > Website Development and Design Discussion > Coding/Programming/Languages
Start your Domain Reseller Business Today and Earn Money!
Reply
 
LinkBack Thread Tools Display Modes
Old 07-30-2007, 07:16 AM   #1 (permalink)
[On holiday]
 
tristanperry's Avatar
 
Name: Tristan
Last Online: Today 05:12 AM
iTrader: (42)
Join Date: Jan 2007
Posts: 1,118
DNF$: 3,338
Location: Wales, UK
Country:


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
__________________
The Legion Host - quality hosting at low prices

On holiday from 28th June - 7th July
tristanperry is offline   Reply With Quote
Sponsored Links
Old 08-04-2007, 12:03 AM   #2 (permalink)
Platinum Lifetime Member
 
liberator's Avatar
 
Name: Jason
Last Online: Today 11:59 AM
iTrader: (6)
Join Date: Jan 2007
Posts: 360
DNF$: 257
Location: Canada
Country:


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);
__________________
Snails.ca - Caterpillars.ca - Swans.ca
liberator is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -4. The time now is 06:12 PM.
Copyright @2001-2008 DNForum.com

Learn Domains
Promote Domains
Research Domains
Buy Domains
Resell Domains
Park Domains
Sell Domains
Build Domains
Host Domains
Trademark Domains
Domain Domains
manage Domains
Appraise Domains