grep: The Backslash Character and Special Expressions

1 
1 3.3 The Backslash Character and Special Expressions
1 ===================================================
1 
1 The ‘\’ character, when followed by certain ordinary characters, takes a
1 special meaning:
1 
1 ‘\b’
1      Match the empty string at the edge of a word.
1 
1 ‘\B’
1      Match the empty string provided it’s not at the edge of a word.
1 
1 ‘\<’
1      Match the empty string at the beginning of word.
1 
1 ‘\>’
1      Match the empty string at the end of word.
1 
1 ‘\w’
1      Match word constituent, it is a synonym for ‘[_[:alnum:]]’.
1 
1 ‘\W’
1      Match non-word constituent, it is a synonym for ‘[^_[:alnum:]]’.
1 
1 ‘\s’
1      Match whitespace, it is a synonym for ‘[[:space:]]’.
1 
1 ‘\S’
1      Match non-whitespace, it is a synonym for ‘[^[:space:]]’.
1 
1    For example, ‘\brat\b’ matches the separate word ‘rat’, ‘\Brat\B’
1 matches ‘crate’ but not ‘furry rat’.
1