ebook on regular expressions for Google Analytics - LunaMetrics
ebook on regular expressions for Google Analytics - LunaMetrics
ebook on regular expressions for Google Analytics - LunaMetrics
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
wilder cardsThE S tAr*People really misuse stars. They have specificmeanings in other applicati<strong>on</strong>s. They d<strong>on</strong>’t mean the same thingin RegEx as they do in some of those other applicati<strong>on</strong>s, so becareful here.Stars will match zero or more of the previous items. They functi<strong>on</strong>just like plus signs, except they allow you to match ZERO (ormore) of the previous items, whereas plus signs require at least<strong>on</strong>e match. For the time being, let’s just define “previous item” as“previous character.”Since stars are so much like plus signs, I’ll start with the sameexample and point out the differences.So <strong>on</strong>ce again, when a character trips and falls <strong>on</strong> his face, heoften says Aaargh! Or maybe it is Aaaargh! or (unlike last time)just Argh! In any case, you could use a star to match the targetstring, like this: aa*rgh. That will match aargh and aaargh andaaaaaaaaargh – and the big difference from the plus sign is thatit will also match argh (i.e. no extra “a’s” added).You’ll notice that I d<strong>on</strong>’t include any screen shots <strong>for</strong> stars (or plussigns, <strong>for</strong> that matter.) While they are both very important, theyare used very extensively with dots as the wildest cards.17