Re: a regular expression problem - split text

From: Date: Sat, 25 Jan 2003 21:08:20 +0000
Subject: Re: a regular expression problem - split text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133126@lists.php.net to get a copy of this message
If I got this right : preg_match_all ("#\!.*?>(.*?)<#si",$string,$match); You will have an array ($match[1]) with all your subs in there. -- georgep ----- Original Message ----- From: "Juan Pablo Aqueveque" <juque@uct.cl> To: <php-general@lists.php.net> Sent: Monday, January 20, 2003 9:11 PM Subject: [PHP] a regular expression problem - split text > Hi all > I am sorry for the very simple question but I can't doing this. > > I have a text like this: > > $text=" <!-- 1 --> this is January <!-- 2 --> this is February <!-- 3 > --> > this is March <!-- 4 --> this is April "; > > OK.. i want to show e.g. "this is January" in my var $sub_text. > > How can i doing this using a regular expressions? > > <?php > > ereg("(help-me-with-a-regulars-expressions-sentence)",text,$sub_text); > echo $sub_text[0]; > > ?> > > thanks a lot > > ________________________________________________________ > Juan Pablo Aqueveque <juque@uct.cl> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#133126) next »