Use the command grep -E and egrep
[root@MongoDB ~]# cat mike.log I am mike! I like linux. I like play football, tennis and reading. my qq is 123456789! my blog is https://i.cnblogs.com my blog is i.miek.com I am miek. not MIEK NOT MIKE miiike miiiie me
1 + repeating one or more characters is different from the previous one (or more * 0)
[root@MongoDB ~]# egrep "mi+e" mike.log my blog is i.miek.com I am miek. miiiie
* The difference between +
[root@MongoDB ~]# egrep "mi*e" mike.log my blog is i.miek.com I am miek. miiiie me
2.? Repeat 0 or a 0 preceding character or not (and. Difference is that one and only one)
A search string or not i m e the end of the beginning
[root@MongoDB ~]# egrep "mi?e" mike.log my blog is i.miek.com I am miek. me
? And The difference
There m e i find the beginning of the end of the string a
[root@MongoDB ~]# egrep "mi.e" mike.log I am mike!
3. | filtration represents more strings
[root@MongoDB ~]# egrep "3306|1521" /etc/services mysql 3306/tcp # MySQL mysql 3306/udp # MySQL ncube-lm 1521/tcp # nCube License Manager ncube-lm 1521/udp # nCube License Manager
4. () packet filtering Backreferences
[root@MongoDB ~]# egrep "mi(ke|ek)" mike.log I am mike! my blog is i.miek.com I am miek.