1、用正則表達式表示IP地址
ifconfig | grep -E -o "(\<([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\>\.){3}(\<[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]25[0-5]\>)"
5、用正則表達式表示手機號13 17 15 18
grep -E – o "^1[3578][0-9]{9}\b"
6、用正則表達式表示身份證號18
"\<[0-9]{16}([0-9]|X)\>"
7、用正則表達式表示郵箱
grep -E -o "[[:alpha:]]+@sina.com"
原創文章,作者:sjfbjs,如若轉載,請注明出處:http://www.www58058.com/30727