- 论坛徽章:
- 1
|
回复 #8 oldoger 的帖子
发现自己没搞清楚“单词边界”的含义,于是……
man grep的这段话应该说明只有在单词被字母、数字或者下划线包围的时候才不满足楼主提到的“完全匹配”吧,所以被“/”这样的符号包围时允许的。
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the
matching substring must either be at the beginning of the line, or preceded by a non-word
constituent character. Similarly, it must be either at the end of the line or followed by a
non-word constituent character. Word-constituent characters are letters, digits, and the
underscore.
不知道这样理解对不对? |
|