View Single Post
Old 08-19-2009, 11:04 AM   #15 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Hmm, it is very interesting to see all of your approaches; for example, I wouldn't have thought to look for the only question mark in there and to use that as a marker!

Well, to conclude this mini-challenge here is what I was thinking of when constructing the challenge:

PHP Code:
$rhyme "Peter Piper picked a peck of pickled peppers;
A peck of pickled peppers Peter Piper picked;
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
This is the line that needs to be removed!"
;

echo 
preg_replace('/.*\z/'''$rhyme); 
Guess I have an unhealthy predilection for regular expressions.

So who wants to create the next mini-challenge?
Salathe is offline  
Reply With Quote