Last active
June 22, 2017 21:35
-
-
Save 4x3LDev/6010009 to your computer and use it in GitHub Desktop.
RegExp Metacharacters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-----------------+----------------------------------------------------------------------------------------------------------+ | |
| Metacharacter | Description | | |
+-----------------+----------------------------------------------------------------------------------------------------------+ | |
| \ | Specifies the next character as either a special character, literal, back reference, or an octal escape. | | |
| ^ | Matches the position at the beginning of the input string. | | |
| $ | Matches the position at the end of the input string. | | |
| * | Matches the preceding subexpression zero or more times. | | |
| + | Matches the preceding subexpression one or more times. | | |
| ? | Matches the preceding subexpression zero or one time. | | |
| {n} | Matches exactly n times, where n is a non-negative integer. | | |
| {n,} | Matches at least n times, n is a non-negative integer. | | |
| {n,m} | Matches at least n and at most m times, where m and n are non-negative integers and n <= m. | | |
| . | Matches any single character except "\n". | | |
| [xyz] | A character set. Matches any one of the enclosed characters. | | |
| x|y | Matches either x or y. | | |
| [^xyz] | A negative character set. Matches any character not enclosed. | | |
| [a-z] | A range of characters. Matches any character in the specified range. | | |
| [^a-z] | A negative range characters. Matches any character not in the specified range. | | |
| \b | Matches a word boundary, that is, the position between a word and a space. | | |
| \B | Matches a nonword boundary. 'er\B' matches the 'er' in "verb" but not the 'er' in "never". | | |
| \d | Matches a digit character. | | |
| \D | Matches a non-digit character. | | |
| \f | Matches a form-feed character. | | |
| \n | Matches a newline character. | | |
| \r | Matches a carriage return character. | | |
| \s | Matches any whitespace character including space, tab, form-feed, etc. | | |
| \S | Matches any non-whitespace character. | | |
| \t | Matches a tab character. | | |
| \v | Matches a vertical tab character. | | |
| \w | Matches any word character including underscore. | | |
| \W | Matches any non-word character. | | |
| \un | Matches n, where n is a Unicode character expressed as four hexadecimal digits. | | |
| | For example, \u00A9 matches the copyright symbol | | |
+-----------------+----------------------------------------------------------------------------------------------------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment