Let us first look at the two special symbols '^' and '$'. Their role is to point out the beginning and end of a string. The example is as follows:
"^ The": indicates all strings starting with "THE" ("there", "the cat", etc.); "Of despair $": means the string ending with "of despair"; "^ ABC $" : Indicates that the start and end are "ABC" strings - huh, only "ABC"; "notice": indicates any string containing "notice".
The last example, if you don't use two special characters, you are in any part of the string to find the string - you don't position it on a top.
Others have the three symbols of '*', ' ' and '' ', indicating that one or a sequence character is repeated. They represent "no or more", "once or more" and "no or once". Here are a few examples:
"ab *": means a string having a A back followed by zero or several b. ("A", "ab", "abbb", ...); "ab ": indicates a string having a A followed by at least one B or more; "ab?": Indicates a string has a A back Follow zero or one B; "a? B $": indicates that there is zero or one A followed one or more b at the end of the string.
You can also use the scope, enclose with braces to indicate the range of repetitions.
"AB {2}": means a string has a A follow 2 B ("abb"); "AB {2,}": indicates a string having a A follow at least 2 b; "AB {3, 5} ": Represents a string having a A follows 3 to 5 B.
Note that you must specify the lower limit of the range (such as "{0, 2}" instead of "{, 2}"). Also, you may notice, '*', ' ' and '' '' correspond to "{0,}", "{1,}" and "{0, 1}". There is also a '|', indicating "or" operation:
"hi|hello": means "hi" or "hello"; "indicates" bef "or" cdef ";" (AQ) * C ": indicating" bef "or" cdef ";" The string "a" "b" mixed string followed by "C";
'.' Can replace any character:
"a. [0-9]": indicates a string with a "A" followed by an arbitrary character and a number; "^. {3} $": indicates a string with any three characters (length 3 Character);
Square brackets indicate that certain characters have occurred in a particular location in a string: "[ab]": means a string has a "A" or "B" (equivalent to "A|B"); "[[[[ AD]: Represents a string contains one of 'a' into 'd' (equivalent to "A|B|C|D" or "[ABCD]"); "^ [A-ZA-Z] ": Represents a string that starts with letters;" [0-9]% ": indicates a number in front of a percentage;", [A-ZA-Z0-9] $ ": Represents a string A comma is followed by a letter or numbers.
You can also use '^' in square brackets to indicate the characters that do not want to appear, '^' should in square brackets. (, Such as "% [^ a-za-z]%" means that letters should not appear in two percent sign).
In order to express verbatics, you must add transfer characters '/' before "^. $ () | * ? {/".
Please note that in square brackets, no escape characters need.