Back to top
Here are some note that may be helpful! Regular expressions use special characters to define
patterns for matching and manipulating text. Here's a list of commonly used special characters in regular
expressions:
1. `.` (dot): Matches any single character except a newline.
2. `*`: Matches zero or more
occurrences of the preceding character or group.
3. `+`: Matches one or more occurrences of the preceding
character or group.
4. `?`: Matches zero or one occurrence of the preceding character or group.
5. `^`:
Matches the start of a line or string.
6. `$`: Matches the end of a line or string.
7. `[]`: Defines a
character set, e.g., `[a-z]` matches any lowercase letter.
8. `[^]`: Defines a negated character set, e.g.,
`[^0-9]` matches anything that's not a digit.
9. `|`: Acts as an OR operator, e.g., `apple|orange` matches
"apple" or "orange".
10. `()`: Groups characters together to apply quantifiers or alternation to them.
11.
`{}`: Defines a specific number of occurrences, e.g., `a{3}` matches "aaa".
12. `\`: Escapes a special
character to treat it as a literal character, e.g., `\\` matches a backslash.
13. `\b`: Matches a word
boundary.
14. `\d`: Matches a digit (equivalent to `[0-9]`).
15. `\s`: Matches a whitespace character
(space, tab, newline, etc.).
16. `\w`: Matches a word character (letter, digit, underscore).
17. `\t`,
`\n`, `\r`: Matches tab, newline, and carriage return respectively.
18. `\A`: Matches the start of the
string.
19. `\Z`: Matches the end of the string.
20. Array: generate 'I like pears. I like bananas.' from string 'I like apples.' and pattern
'apples->{pears,bananas}'
21. Infix expression to prefix expression and function calls. Z0*(1+Gamma_in)/(1-Gamma_in) -> / * Z0 + 1
Gamma_in - 1 Gamma_in and div(mul(Z0,add(1,Gamma_in)),sub(1,Gamma_in))
These are just a few examples of special characters used in regular expressions. Remember that some of these
characters might also have special meanings in JavaScript strings, so you might need to escape them with an
additional backslash when using them in JavaScript regex patterns.
For instance, to match a literal dot in a
regular expression, you would use `\.` because the dot character itself has a special meaning (matches any
character) in regular expressions.
Report bug or leave a comment © 2021 Math is beautiful [email protected]