RegEx
RegEx (short for “regular expression”) is a type of character sequence that specifies a search pattern. It can look daunting at first, but it’s powerful in how much it can encapsulate with a concise sequence of characters. In e?xpress, it’s the driving force that lets a possibility contain multitudes.
A very short primer on RegEx:
a|b: The pipe|means either/or. This sequence matchesaorb.a?b: The question mark|means 0 or 1 of the preceding token. This sequence matchesbandab.a*b: The asterisk*means 0 or more of the preceding token. This sequence matchesb,ab,aab,aaab, and so on.aa|(b?c): The parentheses()group tokens together to be considered in context. This sequence matchesaa,c, andbc.
To learn more, try these resources:
- RegExr: an online tool to learn, build and test RegEx
- A Visual Guide to Regular Expression: an article explaining RegEx using lots of helpful visuals