As the saying goes, "I never metacharacter I didn't like." Once you learn how to use metacharacters, you will wonder how you ever got on without them. This is particularly true in Python. Python has a robust regular expression engine and employs a wide array of metacharacters. The following is a list of the symbols and their uses:
- .: any character except a newline.
- ^: the boundary at the beginning of a character string (the green line)
- $: the boundary at the end of a character string (the other green line)
- *: zero or more instances of a pattern
- +: one or more instances of a pattern
- ?: one or more instances of a pattern
- \: the indicator of an escape sequence
- {}: used to specify parameters for the matching of the regular expression
- []: indicates a set of characters for a single position in the regex
- (): used to group regular expressions
- |: used as an 'or' between two possible matches.
