PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Dec 07, 2019 12:26 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon May 16, 2005 6:08 pm 
Offline
Forum Newbie

Joined: Mon May 16, 2005 5:58 pm
Posts: 2
Hi guys.I need some help
I have this code
Syntax: [ Download ] [ Hide ]
$tekst=preg_replace(array('/(\[php\])(.+)(\[\/php\])/'),highlight_string($2,true),$tekst);

ANd wheni try to use it i don't get higlighted text.I get nubmer 2 in color.

How i can fix this?I was searching a lot but i can't find anything.Please help.I need this urgent


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 16, 2005 6:49 pm 
Offline
Forum Regular
User avatar

Joined: Sun Oct 06, 2002 1:24 pm
Posts: 823
Location: Toronto, Canada


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 4:51 am 
Offline
Forum Newbie

Joined: Mon May 16, 2005 5:58 pm
Posts: 2


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 2:04 pm 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia
The "$2" must be quoted in a string... it would actually give you errors like you have it if you have error reporting on. Same goes for "\\2"

Also... put a "?" after your ".+" because it's greedy and will match too much how you have it. You need the "s" and "e" modifier too.

Good luck!

PS: Moved to regex


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group