| + |
Meaning: Repeat the previous re character of "one or more" Example: Search (God) (good) (Goood) ... And so on the string. The o+ represents "more than one o" so the bottom of the running results will be the 1th, 9, 13 ranks out.
egrep-n ' go+d ' regular_express.txt
|
| ? |
Meaning: "0 or one" of the previous RE character Example: Search (GD) (God) these two strings. The O? stands for "Empty or 1 O" So, the above results will be the 13th, 14 ranks out. Have you found that the result set of these two cases (' go+d ' and ' go?d ') is the same as ' go*d '? Think about it, this is why Oh! ^_^
egrep-n ' go?d ' regular_express.txt
|
| | |
Meaning: Finding several strings in a way or (or) Example: Search for GD or good these two strings, note that is "or"! So, the first three lines of 1,9,14 can be printed out Oh! What if you still want to find the dog?
egrep-n ' Gd|good ' regular_express.txt
Egrep-n ' Gd|good|dog ' regular_express.txt
|
| () |
Meaning: Find the "group" string Example: Search (Glad) or (good) these two strings, because G and D are duplicates, so I can put LA and oo in (), and by | To separate, it's OK!
Egrep-n ' g (la|oo) d ' Regular_express.txt
|
| ()+ |
Meaning: discrimination of multiple repeating groups Example: Call "Axyzxyzxyzxyzc" with Echo, and then use the following method to search for it!
echo ' axyzxyzxyzxyzc ' | egrep ' A (xyz) +c '
above the example means that I'm going to look at the beginning is a end is C, in the middle there is more than one "xyz" string meaning ~ |
Linux Extended formal notation