Regular Expressions Primer
Below are some common regular expression symbols that can be used for pattern matching.
Characters
| Symbol | Meaning | Example |
. | Any character except line break. | hey. would match to heya, heyo, and heyy. |
| […] | Any character specified in the brackets. Use the - symbol to specify a range. | [a-z] would match any character between a and z, such as a, b, x, y. [abc] would match a or b or c. |
Quantifiers
| Symbol | Meaning | Example |
* | Zero or more times. | a* would match aa and aaaaaa. |
? | Once or none. | heya? would match hey and heya. |
Anchors/Boundaries
| Symbol | Meaning | Example |
\b | Word boundary. | no would match no and snow. \bno\b would match no but not snow. |
Additional Resources