考慮這個文本文件:grep的正則表達式
TEST FILE : test #No match
#No match
Run grep "1133*" on this file #Match
#No match
This line contains the number 113. #Match
This line contains the number 13. #No match
This line contains the number 133. #No match
This line contains the number 1133. #Match
This line contains the number 113312. #Match
This line contains the number 1112. #No match
This line contains the number 113312312. #Match
This line contains no numbers at all. #No match
怎樣的grep
命令評估1133*
正則表達式?
爲什麼包含113
的行是正值?
正則表達式1133*
意在表示任何東西比 查找包含字1133+anything else
所有行?
該示例可在tldp文檔頁面找到。
1133 \ *匹配113或1133或11333等,或「無論站在\ *之前的元素出現零次或多次出現」。 – bobah 2012-08-14 13:22:05
您將從學習正則表達式的基礎知識(例如[here](http://regex.learncodethehardway.org/book/))中獲得巨大的收益。 – huon 2012-08-14 13:24:32