问题
From the A Brief Introduction to Regular Expressions
[:blank:] matches a space or a tab.
[:space:] matches whitespace characters (space and horizontal tab).
To me both definitions are the same and I was wondering if they are really duplicates?
If they are different, what are the differences?
回答1:
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'
回答2:
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
回答3:
A space means to pressing a space bar and tab
A white space means it carries the newline,tab,form feed and carriage return and also space that's all.
来源:https://stackoverflow.com/questions/15767863/whats-the-difference-between-space-and-blank