The meaning of 'word' in Grep

前端 未结 1 1140
清酒与你
清酒与你 2021-01-25 20:41

In the man page for grep it says that:

> The symbols \\< and \\> respectively match the empty string at the
> beginning and end of a word.

相关标签:
1条回答
  • 2021-01-25 21:02

    The beginning of a word is a word character (a letter, number, or underscore) that is not preceded by another word character, and the end of a word is a word character that is not followed by another word character. A "word" is then just a series of word characters.

    The reason hi/\> doesn't match hi/ is because the \> is preceded by a non-word character (/), and so that can't be the location of an end-of-word.

    0 讨论(0)
提交回复
热议问题