UE regular expression syntax

Source: Internet
Author: User

%Match the first line-indicates that the search string must start with the line, but does not include the row termination characters in any selected result characters.

$Match the end of a line-indicates that the search string must be at the end of the line, but does not include the end of the line in any selected result character.

?Match any character except the line break.

For example, M? N matches "man", "men", and "min", but does not match "moon ".

*Match any number of characters except line breaks.

For example, T * t matches "Tea t" in "test", "tonight", and "tea time", but does not match "tea ".

Time (there is a line break between "tea" and "time ).

+Match one or more previous characters/expressions. At least one character must be found. Duplicate line breaks are not matched.

For example, te + st matches "test", "teest", and "teeeest", but does not match "TST ".

++Matches the previous character/expression zero or multiple times. Duplicate line breaks are not matched.

^ BMatch a paging character.

^ PMatch a line break (CR/LF) (Section) (DOS/Windows File)

^ RMatch a line break (CR only) (Section) (MAC file)

^ NMatch A linefeed (lf only) (Section) (UNIX file)

^ TMatch a tab

[]Match a single character or range in any parentheses

For example:

[Aeiou] matches each vowel in lower case

[,.?] Match the text ",", ".", or "?".

[0-9a-z] matches any number or lowercase letter

[~ 0-9] match any character except a number (~ Does not match the subsequent content)

^ {A ^} ^ {B ^}Matching expression A or B

For example:

^ {John ^} ^ {Tom ^}

This will search for John or Tom. There should be no other content between two expressions

^ {John ^} ^ {Tom ^} ^ {Smith ^} ^ {Jones ^}

This will search for John or Tom following Smith or Jones.

Note: ^ {John ^} ^ {Tom ^} and ^ {Smith ^} ^ {Jones ^} have a space.

^Ignore the subsequent regular expression characters

^ (* ^)Add parentheses or tags to the expression and use them in the replacement command. There can be 9 expression tags in a regular expression, and numbers are determined based on their order in the regular expression.

The corresponding replacement expression is ^ X, and the range of X is 1-9. For example, if ^ (H * o ^) ^ (F * s ^) matches "Hello folks", ^ 2 ^ 1 indicates that it will be replaced with "Folks hello.

-----------------------------------------------------

Regular Expression Search Skills (ultraedit syntax ):

Delete empty rows: replace % [^ t] ++ ^ P with empty strings.

Remove trailing space: Replace [^ t] + $ with an empty string

Space at the beginning of the row to be deleted: % [^ t] + is replaced with an empty string

Each line starts with four fixed spaces: replace % [^ t] ++ ^ ([~ ^ T ^ p] ^) is "^ 1"

Each segment starts with a fixed 4-digit space: replace % [^ t] + ""
(If a line starts with a space, it is regarded as the starting line of a segment)

Merge a segment into one row: Replace [^ t] ++ ^ P ^ ([~ ^ T ^ p] ^) is ^ 1
(Note: here we assume that the text is a line break in DOS mode-Cr/LF)

Remove HTML Tag: replace ^ {<*> ^} ^ {<* ^ p *> ^} with an empty string.

Delete all <A>: replace <[] ++ A * [] ++ href [] ++ = *> with an empty string.

Delete the first two columns of characters specified in the text: replace % ?? Empty string

Insert 2 blank characters after the first column: replace % ^ (???? ^) ^ (? ^) Is "^ 1 ^ 2"

Search for all numbers: [0-9] + [.] ++ [0-9] +

Find all words: [A-Z] +

Find all urls: http: // [a-z0-9 ^ ~ '_./^-^? = &] +

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.