13.07.2015 Views

Download - The Bastards Book of Regular Expressions

Download - The Bastards Book of Regular Expressions

Download - The Bastards Book of Regular Expressions

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Match zero-or-more with the star sign 48Find Baa+!+Replace Baa!<strong>The</strong> first sheep says “Baa!” Another sheep says “Baa!”. In reply, the sheep says,“Baaaaaa”. Another “Baaa” is heard. Finally, there’s a “Baa!”Because the second + depends on there being at least one exclamation mark in the pattern – i.e.Baa!! – it fails to match a Baaa that doesn’t end with an exclamation mark.AnswerFind Baa+!*Replace Baa!If you know the plus sign operator, then the star sign is just a slightly more flexible variation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!