Regular Expression used for "search and replace" (1)

Source: Internet
Author: User

The regular expressions frequently used in expression Builder are as follows.

Expression Syntax Description Example
Any character . Match any character except the linefeed. A. O matches "ARO" in "und" and "abo" in "about", but does not match "acro" in "across ".
Zero or multiple * Does not match the previous expression, or matches multiple times, and generates all possible matches. A * B matches "B" in "Bat" and "AB" in "about ". E. * E matches the word "enterprise ".
One or more + Match at least one search item of the previous expression. AC + matches words that contain the letter "A" and at least one letter "C", such as "race" and "Ace ". A. + S matches the word "access ".
Beginning of Line ^ Pin the matching string to the beginning of the line. ^ Car matches the word only when the word "car" is displayed as the first character in the editor line.
End of line $ Pin the matching string to the end of the line. End $ matches the word only when the word "end" is shown as the last group of characters that may be at the end of the line in the editor.
First word < A word is matched only when it starts with this in the text. <In matches words starting with the letter "in", such as "Inside" and "".
End > Only when the word ends with this in the text. SS> match words ending with the letter "SS", such as "SS" and "loss ".
Line Break /N Match line breaks unrelated to the operating system. In the replace expression, insert a line break. End/nbegin matches the word "end" and "begin" Only when "end" is the last string in a row and "begin" is the first string in the next row ". In the "replace" expression, begin/nend uses "begin" to replace the word "end" in the first line, inserts a line break, and replaces the word "begin" with the word "end ".
Any character in the Set [] Match any character in. To specify the character range, list the start and end characters separated by a hyphen (-), for example, [A-Z]. Be [n-t] matches "bet" in "between", "Ben" in "Beneath", and "BES" in "beside ", but does not match "BEL" in "below ".
No character in the Set [^...] Match any character that is not specified in the character set following ^. Be [^ n-t] matches "BEF" in "before", "beh" in "behind", and "BEL" in "below ", but it does not match "Ben" in "".
Or | Matches the expression before or after the or symbol (|. It is most commonly used in groups. (Sponge | mud) the bath matches "sponge bath" and "mud bath ".
Escape Character / Match the characters after the backslash (/) according to the original meaning. This allows you to find the characters used in the regular expression representation, such as {and ^. /^ Search for ^ characters.
Markup expression {} Match the text marked with an expression with parentheses. Zo {1} matches "zo1" in "alonzo1" and "gonzo1", but does not match "zo" in "zone ".
C/C ++ identifier : I The short form of an expression ([A-Za-Z _ $] [a-zA-Z0-9 _ $. Matches any possible C/C ++ identifiers.
String with quotation marks : Q The abbreviated expression ("[^"] * ") | ('[^'] * ') matches all characters enclosed by double quotation marks or single quotation marks, it also matches the quotation marks themselves. : Q matches "test reference" and "test reference", but does not match "T" in "can't ".
Space or tab : B Matches spaces or tabs. Public: binterface matches the phrase "public interface" in the text ".
Integer : Z The abbreviation of an expression ([0-9] +) that matches any combination of numeric characters. Matches any integer, such as "1", "234", and "56 ".

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.