JS Regular expression symbol meaning

Source: Internet
Author: User

\ Do as a turn, that is, usually after the "\" character is not interpreted as the original meaning, such as/b/match character "B", when B is preceded by a backslash/\b/, turn to match the boundary of a word.
Or
The restoration of a regular expression feature character, such as "*" matches its preceding metacharacters 0 or more times,/a*/will match a,aa,aaa, adding "\",/a\*/will only match "a *".

^ matches the beginning of an input or a line,/^a/matches "an A", and does not match "an A"
$ matches the end of an input or a line,/a$/matches "an A", and does not match "an A"
* Match the preceding metacharacters 0 or more times,/ba*/will match b,ba,baa,baaa
+ Match Front metacharacters 1 or more times,/ba*/will match ba,baa,baaa
? Match the preceding metacharacters 0 or 1 times,/ba*/will match B,ba
(x) match x Save x in a variable named $1...$9
X|y match x or Y
{n} exact match n times
{n,} matches more than n times
{n,m} matches n-m times
[XYZ] Character set (character set) that matches any one by one characters (or metacharacters) in this set
[^XYZ] does not match any one of the characters in this set
[\b] matches a backspace
\b matches the boundary of a word
\b matches the non-boundary of a word
\CX here, X is a control character,/\cm/matches Ctrl-m
\d matches a character number character,/\d/=/[0-9]/
\d matches a non-alphanumeric character,/\d/=/[^0-9]/
\ n matches a line break
\ r matches a carriage return character
\s matches a white space character, including \n,\r,\f,\t,\v, etc.
\s matches a non-whitespace character equal to/[^\n\f\r\t\v]/
\ t matches a tab
\v matches a straight tab
\w matches a character that can make up a word (alphanumeric, which is my paraphrase, with numbers), including underscores, such as [\w] matches 5 in "$5.98", equals [a-za-z0-9]
\w matches a character that cannot be composed of words, such as [\w] matches $ in "$5.98", equal to [^a-za-z0-9].

JS Regular expression symbol meaning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.