The knowledge carding of regular expressions

Source: Internet
Author: User

First put a URL: https://regexper.com/

This tool is used to help understand regular expressions and is useful when you are reading regular expressions.

Metacharacters

Non-alphabetic characters that have special meanings. Includes: * +? ^ $ . | \ () [] {} , if you can say the meaning of these symbols at once, it means that the basis of the regular expression is mastered.

[]: Used to match a class of Word character;

[^]:[^ indicates that this type of character is not included. The ^ in brackets indicates the meaning of inversion;

[-]: Inside the brackets - meaning of the range.

. : matches all characters.

\d: Match all the numbers;

\d: Matches all non-numbers;

\s: Matches all whitespace characters (space carriage return line)

\s: Matches all non-whitespace characters;

\w: Match alphanumeric underline;

\w: Matches a character other than a non-alphanumeric underscore.

\b: Match word boundaries;

\b: Matches the non-word boundary;

^: match the beginning;

$: Match end;

?: The preceding character is modified to indicate a maximum of 1 occurrences;

+: Modifies the preceding character to indicate a minimum occurrence of 1 occurrences;

*: Modify the preceding character, indicating that it can appear any time;

{n}: Modifies the preceding character, indicating that n times occurs;

{N,}: Indicates at least n occurrences;

{n,m}: Indicates the occurrence of N to M times; The default is greedy mode, as many matches as possible;

{n,m?} : Non-greedy mode, once the match succeeds can no longer match backwards:

(): Grouping to enable quantifiers to act on a set ofcharacters; \ n: Represents the contents of the captured packet (reverse reference);

An expression or meaning; Example:red| Blue matches Red or blue; Example:bl (ue|ack) matches Blue or black;

(? =\d): Assert, modify the preceding character, indicating not only to match the preceding regular content, but also to match the content of the assertion, the assertion part is only verified, not calculated;

The knowledge carding of regular expressions

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.