UE usage tips

Source: Internet
Author: User
Tags ultraedit

I. Use of Regular Expressions

  • Delete empty rows: replace % [^ t] ++ ^ P with empty strings.
  • Replace the carriage return line break: replace ^ P with an empty string
  • 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 is set to a fixed 4-digit space at the beginning: replace % [^ t] + with "" (if a line starts with a space, it is regarded as the starting line of the segment)
  • Merge a segment into one row: Replace [^ t] ++ ^ P ^ ([~ ^ T ^ p] ^) is ^ 1 (note: the text is assumed to be a DOS carriage return line feed-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 ^ ~ '_./^-^? = &] +
  • Replace all characters After spaces or tabs: Replace [^ t] + * $ with null
  • Replace all content with spaces or tabs: replace % * [^ t] with null
  • Blank line or line containing only space and Tab key: replace % [^ t] ++ ^ P with null
  • Add at the end of the row; semicolon character: Replace $;
  • Add four spaces at the beginning of the row: % to four spaces or use the column Block Mode of UE
  • Delete the row containing the varchar string: replace % * varchar * ^ P with null.
  • Separate with; for branch processing: replace; with; ^ P

Ultraedit Regular Expression (ultraedit syntax)
% 1 search for rows starting with 1
1 $ search for rows ending with 1
? Match Single Character
* Match multiple characters
Te + st matches "test", "teest", "teeeest", etc., but does not match "TST ".
Te ++ st matches "test", "teest", "teeeest", "TST", etc., but does not match.
^ P New Line (DoS Files format)
^ R new line (MAC files format)
^ N New Line (UNIX files format)
^ T Tab key
[1-9] matching numbers from 1 to 9
[Linux] matches any word in Linux
[~ 0-9] Any word except a number
"^ {John ^} ^ {Tom ^}" the search for John and Tom such as John sdfasdf Tom is selected. Of course, sdfasdf is not included, where ^ {and ^} Are separators.

 

 

Go to http://blog.163.com/?email protected]/blog/static/282686252011350412615/

Use of UE Regular Expressions

Many of my friends have used or are using ultraedit. This editor has been with me for several years and has influenced my coding shortcut habits in many places. ultraedit provides a rich set of editing functions, the most important search and replacement functions must be used by everyone. The search and replacement functions provided by ultraedit are very convenient and powerful, and can be searched and replaced in a separate file, you can also search and replace multiple files and directories. When using these search and replacement functions, we generally use a string. Two days ago, I had to find and replace a piece of code in all the HTML files under a directory (including subdirectories, I don't know how to operate it at once. Because regular expressions are used in programming for a long time, I guess ultraedit, which has such a powerful function, must also have such a matching function. So I click Help to see it, as expected, ultraedit supports the basic regular expression matching search and replacement functions, which can meet almost all our needs. The following is an example of using a regular expression for searching and replacement in the help of ultraedit. Ultraedit has two sets of syntax that can be used when using regular expressions for search replacement. An earlier version of ultraedit uses the original ultraedit syntax. The other is a regular expression of the "Unix" type. This set is not enabled in the default configuration of ultraedit. You need to find the search item in the configuration to enable the regular expression of the UNIX type. Syntax set-in-One: symbol function % matches the start of a row-displays that the search string must start at the row, but does not include any row termination characters in the selected result string. $ Match the end of a row-show that 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 line breaks match any number of characters and numbers + match one or more previous characters, but at least one ++ character must match zero or more, but at least one ^ B must match one paging ^ P match one linefeed (CR/LF) (segment) (DOS file) ^ r matches a linefeed (CR only) (segment) (MAC file) ^ n matches a linefeed (lf only) (segment) (UNIX file) ^ t matches a tag character tab [] to match any single character, or the range in square brackets ^ {A ^} ^ {B ^} matches expression A or B ^ reloads the regular expression character ^ (^) include or mark 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 wowould replace it with "folks Hello ". (Hello folks will be replaced with folks hello .) Note: ^ is the actual character ^ is not the CTL + key value. 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 "teatime" (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 ",", "." or "?" of a text. [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 ^}" will be directed to Smith or Jones after John or Tom. Syntax 2: Regular Expression symbols of the "UNIX" syntax Type \ 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. For example, match only 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 matches 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. 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 "teatime" (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 ",", "." or "?" of a text. [0-9, A-Z] matches any digit or lowercase letter. [^ 0-9] matches any character except a number (~ It means "no") You can look for an expression A or B as follows: "(John) | (Tom)", which 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 expression is not selected in the search/replace function, the following characters in the replace field are also valid: symbol function ^ matches a "^" character ^ s to replace the selected (highlighted) active file window. ^ C is replaced by the content of the clipboard ^ B matches a page crack ^ P matches a linefeed (CR/LF) (segment) (DOS file) ^ r matches a linefeed (CR only) (segment) (MAC file) ^ n matches a linefeed (lf only) (segment) (UNIX file) ^ t matches a Tab character. Below is an example of code query replacement that I want to implement. remove Chinese characters from the LRC file: [Ti: 046] [AR: book I] [Al: english900] [LA: zh] [. 00] [4] Identifying objects. identify an item. 00] [00: 00. 01] What are these? What are these? [00:01. 93] Those are books. Those are books. [00:03. 87] Where are the books? Where are those books? [. 13] There they are. There. [00:08. 68] These are my pencils. These are my pencils. [. 00] Where are your pens? Where are your pens? [. 85] they're over there. There. [00:17. 48] Are these your pens? Are these your pens? [. 04] Yes, they are. It's mine. [00:22. 63] Those are mine. Those are mine. [00:25. 39] These are your books, aren't they? These books belong to you, right? [. 35] No, they aren't. No, no. [. 07] They're not mine. Not mine. [00:33. 39] These are mine, and those are yours. These are mine, and those are yours. [00:35. 57] Those aren't your pens, are they? Those pens are not yours, right? [. 38]: "Search"-> "replace", select "Regular Expression" to search: ^ ([/./?] ^ )? + $ Replace with: ^ 1: "replace all.

 

UE usage tips

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.