The Essential Regular Expressions Cheat Sheet
A regular expression, also known as a regex or regexp, is a way of defining a search pattern. This Refcard assumes no prior knowledge of regular expressions covers basic features of regular expressions, including normal and special characters, quantifiers, capturing and non-capturing groups, and more.
About Regular Expressions
A regular expression, also known as a regex or regexp, is a way of defining a search pattern. Think of regexes as wildcards on steroids. Using wildcards, *.txt matches any-thing followed by the string ".txt". But regular expressions let you e.g.: match specific characters, refer back to previous matches in the expression, include conditionals within the expression, and much more.
This Refcard assumes basic familiarity with program structures, but no prior knowledge of regular expressions. It would be wise to play with as many of the examples as possible, since mastering regex requires a good deal of practical experience.
If you've been following me for any length of time you'll have heard me whine about how much I stink at regex'ing. I just don't do it near enough to feel comfortable with it, let alone even approach "good." Heck, I'm so far from good I can't see it with binoculars (on a clear day, flat plain, no wind... you get the picture). Man, I'm luckily I can even spell regex. In short, this cheat sheet was written just for me! I guess since it the holidays I can share though... :P
If I were really cool, I'd have created a regex that created that title instead of using literals... But today has been a long week and well, I guess I'll leave that as an exercise for all of you.