Re: Grep Challenge 2001

From: Date: Thu, 23 Aug 2001 15:36:47 +0000
Subject: Re: Grep Challenge 2001
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-64114@lists.php.net to get a copy of this message
Try "/<!--begin variable:?([\w\s]*?)-->([\w\s]*?)/m" the "?" will force PCRE to not be *greedy*. Look in the manual of PCRE for syntaxis. Andrey Hristov IcyGEN Corporation http://www.icygen.com 99% ----- Original Message ----- From: "Sondra Russell" <sondra@sondra.com> To: <php-general@lists.php.net> Sent: Thursday, August 23, 2001 5:32 PM Subject: [PHP] Grep Challenge 2001 > Hello everyone! > > Here's my grep challenge. Turn: > > <!--begin variable: variable_blah--> > blah blah > blah blah > blah blah > blah blah > > <!--begin variable: variable_blah2--> > blah 2 blah 2 > blah 2 blah 2 > blah 2 blah 2 > blah 2 blah 2 > > into: > (variable_blah) (blah blah blah blah blah blah blah blah) > (variable_blah2) (blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 blah 2 ) > > Where the "blahs" (that are not part of the variable name) contain > practically anything but the next comment "<!--begin variable:". > Also the "blahs" maintain their \n and such (I just flattened those > values out for demo purposes here). > > I've tried:"/<!--begin variable:?([\w\s]*)-->([\w\s]*)/m", but that > misses out on any punctuation and "/<!--begin > variable:?([\w\s]*)-->(.*)/m" gives me some other weirdness-- it > doesn't find anything at all for the second substring. > > Any suggestions! > > Thanks cowboys! > Sondra > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#64114) next »