Regular Expressions
Regular expressions are worth learning. I keep some of the trickier syntax on this page for quick reference.
Lookarounds
Lookarounds are useful when you want to match (or exclude) results based on what comes before or after the current position.
Name | Expression | Description |
---|---|---|
Lookahead | (?=pattern) |
Asserts that the string following the current position is “pattern” |
Negative Lookahead | (?!pattern) |
Asserts that the string following the current position is not “pattern” |
Lookbehind | (?<=pattern) |
Asserts that the string preceding the current position is “pattern” |
Negative Lookbehind | (?<!pattern) |
Asserts that the string preceding the current position is not “pattern” |
Useful Tools
Rubular: a Ruby regular expression editor
0 likes, retweets, and replies