Regular Expression, Regular Expression

Source: Internet
Author: User

Regular Expression, Regular Expression

Regular Expressions are arranged by special characters to find, replace, and delete one or more character strings. In short, regular expressions are an "expression" used to process strings ", is a standard basis for string processing.

Regular Expressions are classified:Basic Regular ExpressionAndExtended Regular Expression.

 

These are all summarized by the big guys, including the basics and extensions.

 

I. Basic Regular Expressions

(1 ),^ Word: The string (word) to be searched at the beginning of the line

(2 ),Word $: The string (word) to be searched at the end of the row

(3 ),.: Represents a character that must contain any character

For example, there must be a character in the middle of 'G. G '.

(4 ),\: Escape characters to remove the special meaning of special symbols

For example, '\ *' searches for characters *

(5 ),*: Repeats the first character from 0 to infinity.

For example, 'so * 'is used to search for strings such as so, soo, and sooo.

(6 ),[List]: Find the desired character from the RE character of the character set.

For example, 'a [rc] t' indicates a character in art, act, and [].

(7 ),N1-n2: Find the range of characters to be selected from the RE characters of the character set.

(8 ),[^ List]: Find unwanted characters or ranges from the RE characters in the character set.

(9 ),\ {N, m \}: The first character of n to m consecutive. If it is \ {n \}, it is the first character of n consecutive times.

 

 

Ii. Extended Regular Expressions

(1 ),+: Repeat one or more previous RE characters

For example, 'Go + d' is used to search for strings such as good and goood.

(2 ),?: 0 or the first character of one

(3 ),|: Search by or

For example, 'good | better' searches for good and better.

(4 ),(): Search for the "Group" String

For example, 'G (oo | la) 'is used to find good or gglad, which is similar to [list ].

(5 ),() +: Identification of multiple repeated groups

 

 

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.