Grep Challenge 2001
| From: | Sondra Russell | Date: | Thu, 23 Aug 2001 14:32:01 +0000 |
| Subject: | Grep Challenge 2001 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64097@lists.php.net to get a copy of this message | ||
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