Egrep is to return a matching position instead of matching the string itself. Egrep returns the newline character is removed before the regular expression is checked.
If you match some characters that are the same as the metacharacters, but to make him meaningless, use "\" before the characters to represent the general meaning
^pepple-Represents a match to a $people that begins with a people line---represents a match that starts with a people line [^ ....] ----match in addition to the parentheses content
Metacharacters: "." can match any character set of characters shorthand to match 09-02-1 or 09.02.1 or 09/02/01
Regular expression "09[-. /]02[-./]01 "Where [-./] This symbol is not a meta-character, because inside a character group
Regular expression "09.02.01" this and the regular expression above a meaning, at this time the "." Represents a meta-character that can match any character
| The meaning of an expression or
For example: gr (e|a) y to match grey and Gray
The egrep command parameter line "-i" indicates a match that ignores the case
Egrep-i "^ (from|subject|date):"-I write in front of regular expressions
Egrep "/<" matches the beginning of the word, "/>" matches the end of the word: the word that is expected to match is in the other but this time
Egrep "/<cat/>" begins with a cat and ends with a cat word,
? Represents an option
For example, match color and colour match, can be written as "(Colour)" This U is optional or optional
+ indicates that the immediate element appears one or more times, * indicates that the element immediately preceding it appears any number of times or does not appear
Example: Match 14
Available "[0-9]+"
Brackets and Reverse applications
Three uses of parentheses: 1) limit the range of multiple options 2) combine several characters into a single unit, subject to a question mark or a quantifier like an asterisk 3) for reverse referencing
Egrep the reverse reference
For example: We want to match an arbitrary word, and then we check to see if the following word is the same as it.
The regular expression:\< ([a-za-z]+) *+\1\> represents the beginning of the first matching word, ending with the last word that appears as the first word. "\1" "\2" "\3" to represent the first, second, and third set of bracketed text.
([A-z]) ([0-9]) \1\2 ". Brackets are in the order of opening parentheses "(" from left to right, so \1 ([a-z]) represents \2 ([0-9])
Regular Expressions (2)