The regular expressions used to describe a single string matching, a series of matching a string of syntactic rules. in many text editors, the regular expression is usually used to search and replace those matching a pattern. - Wikipedia
In other words, it is a sort of string matching rules, the use of regular expressions can be matched to all conform to the rules of the string, such as "[a-z]" can match all lowercase letters, "\d+" can match all the individual numbers, etc.
The App provides some of the more commonly used regular expressions, you can click "load regular expressions" in the menu to use the default value. Of course, you can also write regular expressions according to the rules below, and stored them in the list of regular expressions for future use.
When regular expression function is opened, the "$" sign can have special meanings according to the following expression. You can use these expressions below in the replace results.
$$:Means a single $ character.
$val:The string that is currently matching.
$num:The counting number of the currently matching string.
$rev:The string that is currently matching after reversal.
$len:The length of the currently matching string.
$upp:The string that is currently matching after switching to all
uppercase.
$low:The string that is currently matching after switching to all
lowercase.
| Character | Meaning |
|---|---|
\ |
Matches according to the following rules: |
^ |
Matches beginning of input. If the multiline flag is set to true, also matches
immediately after a line break character. For example, /^A/ does not match the 'A' in "an A", but does match the 'A'
in "An E".The ' ^' has a different meaning when it appears as the first character in a
character set pattern. See complemented character sets for details
and an example.
|
$ |
Matches end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, |
* |
Matches the preceding expression 0 or more times. Equivalent to {0,}. For example, |
+ |
Matches the preceding expression 1 or more times. Equivalent to For example, |
? |
Matches the preceding expression 0 or 1 time. Equivalent to {0,1}.For example, /e?le?/ matches the 'el' in "angel" and the 'le' in "angle"
and also the 'l' in "oslo".If used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-greedy (matching the fewest possible characters), as opposed to the default, which is greedy (matching as many characters as possible). For example, applying /\d+/ to "123abc" matches "123". But applying /\d+?/ to that
same string matches only the "1".Also used in lookahead assertions, as described in the x(?=y) and x(?!y)
entries of this table. |
. |
(The decimal point) matches any single character except the newline character. For example, |
(x) |
Matches 'x' and remembers the match, as the following example shows. The parentheses
are called capturing parentheses. |
(?:x) |
Matches 'x' but does not remember the match. The parentheses are called non-capturing
parentheses, and let you define subexpressions for regular expression operators to
work with. Consider the sample expression /(?:foo){1,2}/. If the expression
was /foo{1,2}/, the {1,2} characters would apply only to the
last 'o' in 'foo'. With the non-capturing parentheses, the {1,2} applies to
the entire word 'foo'. For more information, see Using
parentheses below.
|
x(?=y) |
Matches 'x' only if 'x' is followed by 'y'. This is called a lookahead. For example, |
x(?!y) |
Matches 'x' only if 'x' is not followed by 'y'. This is called a negated lookahead. For example, |
(?<=y)x |
Matches For example, / |
(?<!y)x |
Matches For example, |
x|y |
Matches 'x', or 'y' (if there is no match for 'x'). For example, |
{n} |
Matches exactly n occurrences of the preceding expression. N must be a positive integer. For example, /a{2}/ doesn't match the 'a' in "candy," but it does match all
of the a's in "caandy," and the first two a's in "caaandy."
|
{n,} |
Matches at least n occurrences of the preceding expression. N must be a positive integer. For example, /a{2,}/ will match "aa", "aaaa" and "aaaaa" but not "a" |
{n,m} |
Where For example, |
[xyz] |
Character set. This pattern type matches any one of the characters in the brackets,
including escape
sequences. Special characters like the dot(.) and asterisk
(*) are not special inside a character set, so they don't need to be
escaped. You can specify a range of characters by using a hyphen, as the following
examples illustrate.The pattern [a-d], which performs the same match as [abcd],
matches the 'b' in "brisket" and the 'c' in "city". The patterns /[a-z.]+/ and
/[\w.]+/ match the entire string "test.i.ng".
|
[^xyz] |
A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen. Everything that works in the normal character set also works here. For example, |
[\b] |
Matches a backspace (U+0008). You need to use square brackets if you want to match a
literal backspace character. (Not to be confused with \b.)
|
\b |
Matches a word boundary. A word boundary matches the position between a word
character followed by a non-word character, or between a non-word character followed
by a word character, or the beginning of the string, or the end of the string. A
word boundary is not a "character" to be matched; like an anchor, a word boundary is
not included in the match. In other words, the length of a matched word boundary is
zero. (Not to be confused with Examples using the input string "moon": Note: JavaScript's regular expression engine defines a specific set of characters to be "word" characters. Any character not in that set is considered a non-word character. This set of characters is fairly limited: it consists solely of the Roman alphabet in both upper- and lower-case, decimal digits, and the underscore character. Accented characters, such as "é" or "ü" are, unfortunately, treated as non-word characters for the purposes of word boundaries, as are ideographic characters in general. |
\B |
Matches a non-word boundary. This matches the following cases:
For example, |
\cX |
Where X is a character ranging from A to Z. Matches a control character in a string. For example, |
\d |
Matches a digit character. Equivalent to For example, |
\D |
Matches a non-digit character. Equivalent to For example, |
\f |
Matches a form feed (U+000C). |
\n |
Matches a line feed (U+000A). |
\r |
Matches a carriage return (U+000D). |
\s |
Matches a white space character, including space, tab, form feed, line feed.
Equivalent to For example, |
\S |
Matches a character other than white space. Equivalent to For example, |
\t |
Matches a tab (U+0009). |
\v |
Matches a vertical tab (U+000B). |
\w |
Matches any alphanumeric character including the underscore. Equivalent to For example, |
\W |
Matches any non-word character. Equivalent to For example, |
\n |
Where n is a positive integer, a back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, |
\0 |
Matches a NULL (U+0000) character. Do not follow this with another digit, because \0<digits>
is an octal escape
sequence. Instead use \x00.
|
\xhh |
Matches the character with the code hh (two hexadecimal digits) |
\uhhhh |
Matches the character with the code hhhh (four hexadecimal digits). |
\u{hhhh} |
(only when u flag is set) Matches the character with the Unicode value hhhh (hexadecimal digits). |