A. Regular expressions can you do?
1. Locate the line with the rules of the contents from a large section of the text
2. determine whether a string is completely in line with the rules
Second group of characters - [] written in parenthesis content, appear in a certain position following characters are in line with the rules on
[0-9] match numbers
[az] matches lowercase letters
[AZ] matches uppercase letters
[a-zA-Z] matches lowercase letters
[a-zA-Z0-9] Match case letters + numbers
[a-zA- Z0-9_] match line alphanumeric decline
III. Metacharacter
\ w word lines fell matching alphanumeric key [A-zA-Z0-9_]
\ D matches any numeric digit for [0-9]
\ S matches all whitespace carriage return / line feed tab spaces Space [\ n \ t]
newline carriage return \ n
matching tab tab \ t
matches a space
\ W \ D \ S and \ w \ d \ s negation
[\ s \ S] [\ d \ D] [\ w \ W] are three sets of complete works meant to match all the characters
\ b represents a word boundary
IV. Letter and related meta escape character
\ w \ d \ s (\ n \ t) \ b \ W \ D \ S
^ $
^ Matches the beginning of a string
$ Matches the end of a string
It indicates that match all characters except a newline
[] Appear in parentheses as long as the content can be matched
[^] As long as no content in brackets can now be matched
There are some special meaning metacharacters into the character group will return its original meaning: |. [] ()
a | b or b comply with a rule or rules can be matched
If a rule is part of the rules of b, b rule and a rule than to harsh / long, EDITORIAL put a rule, more complex \ longer rules written at the top
() Grouping to represent several characters plus quantifier constraints when demand, give these quantifiers in the same group
V. quantifier
{n} represents prior quantifier character appears n times
{n,} represents the previous quantifier character appears n times at least
{n, m} indicates the previous quantifier character appears nm times
? represents prior quantifiers character appears 0 times 1 represents an option or
+ means before quantifiers character appears once or more
* indicates prior quantifiers characters appear zero or more times
Six regular expression matching characteristics: Greedy matching
it takes the longest in a range to allow the
non-greedy / inert match:? Quantifier plus later
. * X matches any arbitrary length until the non-line feed characters? x encountered stops