What's the difference between [:space:] and [:blank:]?

For the GNU tools the following from grep.info applies:

[:blank:]

     Blank characters: space and tab.

[:space:]

     Space characters: in the 'C' locale, this is tab, newline,
     vertical tab, form feed, carriage return, and space.

You can find the section with this command:

info grep 'Regular Expressions' 'Character Classes and Bracket Expressions'

A better explanation of what they each match is available here

  • http://www.regular-expressions.info/posixbrackets.html

The biggest difference is that [:space:] will also match items like new line characters

Tags:

Regex

Bash

Grep