考虑这个文本文件: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