Re: preg_match help?

From: Date: Sat, 17 Aug 2002 22:48:42 +0000
Subject: Re: preg_match help?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113097@lists.php.net to get a copy of this message
preg_match("/.*<b[^>]+>(.*)<font face=\"Verdana\" size=\"3\">.*/", $contents,$story); echo $story[1]; preg_match always return a array. The first element ($array[0])contains your complete regexp. The next ($array[1])one the first match between () etc. Don't use ! but / Op zondag 18 augustus 2002 01:27, schreef Jason Soza: > I seriously need some help trying to make a match here. Obligatory > disclaimer: yes, I've searched google.com, I've read the PHP manual section > on preg_match(), and I've sat here for 3 hours trying to resolve this on my > own. :) Any help would be great: > > I need to match everything between: > > <b>$headline > > Where $headline is a variable that will be filled out of a foreach() loop. > The pattern should return everything until it hits: > > <font face="Verdana" size="3"> > > The text file this is taken out of looks like: > > <font face="Verdana" size="3"><b>Headline > here</b></font><p> > > News story, blah, blah, blah... > > <font face="Verdana" size="3"><b>Another > headline</b></font><p> > > More news, blah, blah... > > ... > > The contents of the text file echo correctly before the preg_match, but the > preg_match I've tried: > > preg_match("!<b[^>]+>(.*)<font face=\"Verdana\" > size=\"3\">!", $contents, > $story); > > Returns array(), so no matches are made. Any suggestions? > > TIA, > > Jason Soza

« previous php.general (#113097) next »