Basic syntax for [rendering] regular Expressions (ii)
Source: Internet
Author: User
Syntax | There is also a ' | ', which means "or" action:
"Hi|hello": means "hi" or "Hello" in a string;
"(B|CD) EF": means "bef" or "cdef";
"(a|b) *c": Represents a string of "a" "B" mixed strings followed by a "C";
'.' You can override any character:
"A.[0-9]": Indicates that a string has a "a" followed by an arbitrary character and a number;
"^. {3}$ ": A string representing any three characters (3 characters in length);
The square brackets indicate that certain characters are allowed to appear at a specific position in a string:
"[AB]": Indicates that a string has a "a" or "B" (equivalent to "a|b");
[A-d]: Indicates that a string contains one of the lowercase ' a ' to ' d ' (equivalent to "a|b|c|d" or "[ABCD]");
"^[a-za-z]": Represents a string that begins with a letter;
"[0-9]%": Indicates a digit before a percent semicolon;
", [a-za-z0-9]$": Indicates that a string ends with a comma followed by a letter or number.
You can also use ' ^ ' in square brackets to indicate a character that you do not want to appear, ' ^ ' should be first in square brackets. (For example, "%[^a-za-z]%" means that no letters should appear in the two percent sign).
In order to express it verbatim, you have to be in "^.$ () |*+?" {\ ' Precede these characters with the transfer character ' \ '.
Note that in square brackets, you do not need an escape character.
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