Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Thank you for the answer. Maybe mention that your quotes are from the GNU grep manual, assuming that is where they are from, and provide a link. Commented Sep 8, 2020 at 18:13
  • According to Tom Christiansen this inherits from Vi, so that's probably worth mentioning, assuming you know it to be true. Also, I'm not at all familiar with regexes, but am I supposed to know what the expression ‘[_[:alnum:]]’ means? Commented Sep 8, 2020 at 18:19
  • @FaheemMitha You probably know that [ ... ] is a "character list", so this matches any single character contained in the square brackets (think of it as a convenient "OR" of single characters, only with the possibility to easily define ranges, as in [a-z]. The [:alnum:] within that character list is a "character class" - a POSIX extension to regular expressions and again a shorthand method for defining "umbrella" character lists. [:alnum:] contains all "alphanumeric" characters, i.e. alphabetic characters+numbers. So, [_[:alnum:]] matches alphanumeric chars plus the underscore. Commented Sep 10, 2020 at 10:33