Re: Another regex problem - help!

From: Date: Sat, 16 Oct 2004 22:42:32 +0000
Subject: Re: Another regex problem - help!
Groups: php.general 
Request: Send a blank email to php-general+get-199643@lists.php.net to get a copy of this message
On Sunday 17 October 2004 03:54, Murray @ PlanetThoughtful wrote: > In this case, I'm trying to perform a preg_match using the following > expression: > > preg_match("/^\[\[ft".$fn[1].":(.*)\]\]$/m",$content,$ft); Nearly there, except that ']' is not a special char and should not be escaped. > In the above example, the preg_match would be applied twice, once with a > $fn[1] value of 1, the second time with a $fn[1] value of 2. The $content > variable contains the string above. Not sure why you would want to apply the regex more than once. You use: preg_match_all('/^\[\[ft\d{1}:(.*)]]$/m', $content, $ft) That will match ft0 upto ft9, season to taste. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Life is difficult because it is non-linear. */

« previous php.general (#199643) next »