Simple Patterns
- metacharacters :
- . ^ $ * + ? { [ ] \ | ( )
- [abc] = [a-c] : will match any of the characters "a", "b" or "c"
- metacharacters are not active inside classes.
- [abc$] : will match any of the characters of "a", "b", "c" or "$"
- "$" is usually a metacharacter, but inside a character class it's stripped of its special nature.
- not within the range-- complementing
- [^5] : will match any character except "5"
- .
- match anything except a newline character
- "\" is used to escape all the metacharactes so you can still match them in patterns
- \[ or \\ : match "[" or "\"
- \d = [0-9]
- match any decimal digit
- \D = [^0-9]
- match any non-digit character
- \s = [\t\n\r\f\v]
- match nay whitespace character
- \S = [^\t\n\r\f\v]
- match any non-whitespace character
- \w = [a-zA-Z0-9_]
- match any alphanumeric character
- \W = [^a-zA-Z0-9_]
- match any non-alphanumeric character