Ultraedit Regular Expression

Source: Internet
Author: User
Tags ultraedit

Regular Expression (ultraedit syntax ):

% 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 row termination character in any selected result character.

? Match any character except the line break.

* Match any number of characters except line breaks.

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

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

^ B matches a paging character.

^ P matches a linefeed (CR/LF) (Section) (DOS file)

^ R matches a line break (CR only) (Section) (MAC file)

^ N matches a linefeed (lf only) (Section) (UNIX file)

^ T matches a tab

[] Match a single character or range in any parentheses

^ {A ^} ^ {B ^} matching expression A or B

^ Ignore the subsequent regular expression characters

^ (* ^) Add parentheses or tags in the expression to use 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.