Ultraedit regular expression-delete all rows containing a string.

Source: Internet
Author: User
Tags expression engine ultraedit
Ultraedit implements "deleting all rows containing a keyword"

1. Press Ctrl + R to bring up the "replace dialog box"
2. Check "Regular Expression" and "replace all from the top of the file" in the lower left corner (the regular expression engine uses ultraedit)
3. Enter * select * ^ P after "search content ".
4. leave it blank after "Replace"
5. Click "replace all" on the right"

However, note that ^ P is only used in UNIX encoding format, and ^ N is used in DOS encoding format.

DOS format of UE:

There are two types of plain text files (excluding Mac format). One is a combination of "carriage return + line feed" and "\ r \ n" at the end of a line, the other is only line feed, that is, "\ n". The two formats are dos and UNIX, the so-called conversion to DOS format refers to this conversion.

The following explains the ultraedit regular expression:

First, you need to press "advanced"-"configuration"-"Search"-"Regular Expression Engine" in ue to select which regular expression to use.

If you select "ultraedit-style regular expression", you will use the syntax rules of "ultraedit-style regular expression" in future search and replacement functions.

In the current version, "Perl-Compatible Regular Expressions" are also added, which will be mentioned in future articles.

Symbol function
% Match the start of a row-show that the search string must start at the row, but does not include any line terminator in the selected result string.
$ Match the end of a row-the search string must be at the end of the row, but the selected result string does not contain any line terminator.
? Match any single character except line breaks
* Except for line breaks that match any number of characters and numbers
+ Match one or more of the previous characters, but at least one
++ The first character matches zero or more characters, but at least one character must appear.
^ B matches a page
^ P matches a linefeed (CR/LF) (segment) (DOS file)
^ R matches a line break (CR only) (segment) (MAC file)
^ N matches a linefeed (lf only) (segment) (UNIX file)
^ T matches a Tab character
[] Match any single character or range in square brackets
^ {A ^} ^ {B ^} matching expression A or B
^ Reload the regular expression character
^ (^) Includes or is marked as the expression used to replace the command.

A regular expression can have a maximum of nine annotation expressions, depending on the needs of regular expressions.
The corresponding replacement expression is ^ X, and the replacement range is 1-9. For example:
If ^ (H * o ^) ^ (F * s ^) matches "Hello folks ",
^ 2 ^ 1 wocould replace it with "Folks hello ".

(Hello folks will be replaced with folks hello .)

Note: ^ is the actual character ^ is not the CTL + key value.

For example:
M? N matches "man", "men", "min", but does not match "moon ".
T * t matches "test", "tonight" and "tea time" (the "Tea t" portion) but does not match "tea"
Time "(newline between" tea "and" time ").
Te + st matches "test", "teest", "teeeest", and so on. But does not match "TST ".
[Aeiou] matches each lowercase vowel.
[,.?] Match the ",", "." or "? ".
[0-9, A-Z] matches any digit or lowercase letter.
[~ 0-9] matches any character except a number (~ Meaning "no ")

You can search for an expression A or B as follows:

"^ {John ^} ^ {Tom ^ }"

This will appear in John or Tom. There should be nothing between two expressions.

You can combine A or B and C or D in the same search as follows:

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

This will find Smith or Jones behind John or Tom.

The following table is a regular expression of the "Unix" syntax type.

Regular Expression (UNIX syntax ):

Symbol function
Mark the next character as a special character.
"N" matches the character "N ". "N" is a line break or line break.
^ Match/locate the beginning of the row.
$ Match/locate the end of the row.
* Match the preceding characters zero or multiple times. Example
+ Match the preceding characters once or multiple times. Example
. Match except one line break to match any single character.
(Expression) the expression used to replace the command. A regular expression can have a maximum of 9 annotation expressions as needed. 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 wocould replace it with "Folks hello ".
(Hello folks will be replaced with folks hello .)

[Xyz] A character set. Matches any character between square brackets.
[^ XYZ] A negative character set. Does not match any character between square brackets.
D matches a numeric character. It is equivalent to [0-9].
D. match a non-numeric character. It is equivalent to [^ 0-9].
F matches a new character.
N matches a newline character.
R matches a carriage return character.
S matches any blank space, Tag, or page feed, including spaces, but does not match line breaks.
S matches any non-blank characters, but does not match line breaks.
T matches a Tab character.
V matches a vertical label character.
W matches any word characters including underscores.
W matches any non-word characters.

Note: ^ is the actual character ^ is not the CTL + key value.

For example:
M. N matches "man", "men", "min", but does not match "moon ".
T + T matches "test", "tonight" and "tea time" (the "Tea t" portion) but does not match "tea"
Time "(newline between" tea "and" time ").
Te * st matches "test", "teest", "teeeest", and so on. But does not match "TST ".
[Aeiou] matches each lowercase vowel.
[,.?] Match the ",", "." or "? ".
[0-9, A-Z] matches any digit or lowercase letter.
[^ 0-9] matches any character except a number (~ Meaning "no ")

You can search for an expression A or B as follows:

"(John) | (Tom )"

This will appear in John or Tom. There should be nothing between two expressions.

You can combine A or B and C or D in the same search as follows:

"(John | Tom) (Smith | Jones )"

This will find Smith or Jones behind John or Tom.

In addition:

P matches Cr/LF (same as RN) as DoS row Terminator

If the regular expression is not selected in the search/replace function, the following characters in the replacement field are also valid:

Symbol function

^ Match a "^" Character
^ S is replaced by the selected (highlighted) active file window.
^ C Replace with the clipboard content
^ B matches a page Crack
^ P matches a linefeed (CR/LF) (segment) (DOS file)
^ R matches a line break (CR only) (segment) (MAC file)
^ N matches a linefeed (lf only) (segment) (UNIX file)
^ T matches a Tab character

Ultraedit implements "deleting all rows containing a keyword"

1. Press Ctrl + R to bring up the "replace dialog box"
2. Check "Regular Expression" and "replace all from the top of the file" in the lower left corner (the regular expression engine uses ultraedit)
3. Enter * select * ^ P after "search content ".
4. leave it blank after "Replace"
5. Click "replace all" on the right"

However, note that ^ P is only used in UNIX encoding format, and ^ N is used in DOS encoding format.

DOS format of UE:

There are two types of plain text files (excluding Mac format). One is a combination of "carriage return + line feed" and "\ r \ n" at the end of a line, the other is only line feed, that is, "\ n". The two formats are dos and UNIX, the so-called conversion to DOS format refers to this conversion.

The following explains the ultraedit regular expression:

First, you need to press "advanced"-"configuration"-"Search"-"Regular Expression Engine" in ue to select which regular expression to use.

If you select "ultraedit-style regular expression", you will use the syntax rules of "ultraedit-style regular expression" in future search and replacement functions.

In the current version, "Perl-Compatible Regular Expressions" are also added, which will be mentioned in future articles.

Symbol function
% Match the start of a row-show that the search string must start at the row, but does not include any line terminator in the selected result string.
$ Match the end of a row-the search string must be at the end of the row, but the selected result string does not contain any line terminator.
? Match any single character except line breaks
* Except for line breaks that match any number of characters and numbers
+ Match one or more of the previous characters, but at least one
++ The first character matches zero or more characters, but at least one character must appear.
^ B matches a page
^ P matches a linefeed (CR/LF) (segment) (DOS file)
^ R matches a line break (CR only) (segment) (MAC file)
^ N matches a linefeed (lf only) (segment) (UNIX file)
^ T matches a Tab character
[] Match any single character or range in square brackets
^ {A ^} ^ {B ^} matching expression A or B
^ Reload the regular expression character
^ (^) Includes or is marked as the expression used to replace the command.

A regular expression can have a maximum of nine annotation expressions, depending on the needs of regular expressions.
The corresponding replacement expression is ^ X, and the replacement range is 1-9. For example:
If ^ (H * o ^) ^ (F * s ^) matches "Hello folks ",
^ 2 ^ 1 wocould replace it with "Folks hello ".

(Hello folks will be replaced with folks hello .)

Note: ^ is the actual character ^ is not the CTL + key value.

For example:
M? N matches "man", "men", "min", but does not match "moon ".
T * t matches "test", "tonight" and "tea time" (the "Tea t" portion) but does not match "tea"
Time "(newline between" tea "and" time ").
Te + st matches "test", "teest", "teeeest", and so on. But does not match "TST ".
[Aeiou] matches each lowercase vowel.
[,.?] Match the ",", "." or "? ".
[0-9, A-Z] matches any digit or lowercase letter.
[~ 0-9] matches any character except a number (~ Meaning "no ")

You can search for an expression A or B as follows:

"^ {John ^} ^ {Tom ^ }"

This will appear in John or Tom. There should be nothing between two expressions.

You can combine A or B and C or D in the same search as follows:

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

This will find Smith or Jones behind John or Tom.

The following table is a regular expression of the "Unix" syntax type.

Regular Expression (UNIX syntax ):

Symbol function
Mark the next character as a special character.
"N" matches the character "N ". "N" is a line break or line break.
^ Match/locate the beginning of the row.
$ Match/locate the end of the row.
* Match the preceding characters zero or multiple times. Example
+ Match the preceding characters once or multiple times. Example
. Match except one line break to match any single character.
(Expression) the expression used to replace the command. A regular expression can have a maximum of 9 annotation expressions as needed. 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 wocould replace it with "Folks hello ".
(Hello folks will be replaced with folks hello .)

[Xyz] A character set. Matches any character between square brackets.
[^ XYZ] A negative character set. Does not match any character between square brackets.
D matches a numeric character. It is equivalent to [0-9].
D. match a non-numeric character. It is equivalent to [^ 0-9].
F matches a new character.
N matches a newline character.
R matches a carriage return character.
S matches any blank space, Tag, or page feed, including spaces, but does not match line breaks.
S matches any non-blank characters, but does not match line breaks.
T matches a Tab character.
V matches a vertical label character.
W matches any word characters including underscores.
W matches any non-word characters.

Note: ^ is the actual character ^ is not the CTL + key value.

For example:
M. N matches "man", "men", "min", but does not match "moon ".
T + T matches "test", "tonight" and "tea time" (the "Tea t" portion) but does not match "tea"
Time "(newline between" tea "and" time ").
Te * st matches "test", "teest", "teeeest", and so on. But does not match "TST ".
[Aeiou] matches each lowercase vowel.
[,.?] Match the ",", "." or "? ".
[0-9, A-Z] matches any digit or lowercase letter.
[^ 0-9] matches any character except a number (~ Meaning "no ")

You can search for an expression A or B as follows:

"(John) | (Tom )"

This will appear in John or Tom. There should be nothing between two expressions.

You can combine A or B and C or D in the same search as follows:

"(John | Tom) (Smith | Jones )"

This will find Smith or Jones behind John or Tom.

In addition:

P matches Cr/LF (same as RN) as DoS row Terminator

If the regular expression is not selected in the search/replace function, the following characters in the replacement field are also valid:

Symbol function

^ Match a "^" Character
^ S is replaced by the selected (highlighted) active file window.
^ C Replace with the clipboard content
^ B matches a page Crack
^ P matches a linefeed (CR/LF) (segment) (DOS file)
^ R matches a line break (CR only) (segment) (MAC file)
^ N matches a linefeed (lf only) (segment) (UNIX file)
^ T matches a Tab character

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.