Regex cheatsheet
- `\` backlash is used for escaping special character sequences.
- `. ^ $ ? ( ) + * | \ [ ] { }` These are some special characters in regex, use `\` to escape them.
- `.` Matches any character.
- `+` Matches one or more occurences of the preceding pattern.
- `*` Matches zero or more occurences of the preceding pattern.
- `\d` Matches digits, similar to [0-9].
- `\s?` Check for optional whitespace character.
- `|` OR operator allows you check multiple patterns at once.
- `(` and `)` Parenthesis creates capture groups.
- `[` and `]` Square brackets matches any single character within the brackets.
- `{` and `}` Curly braces specifies the number of occurences of the preceding pattern.
- `?=` Checks further only if condition after ?= is satisfied. Example, (?=.*[a-z]) ensures that there is atleast one lowercase character.