grep - Bugs: bug #30515, Grep now seems to interpret \s in...
You are not allowed to post comments on this tracker with your current authentication level.
bug #30515: Grep now seems to interpret \s in the regex as whitespace
Submitter: | Gene Hightower <Digilicious> | ||
Submitted: | Thu 22 Jul 2010 12:05:40 AM UTC | ||
Category: | None | Severity: | 3 - Normal |
Item Group: | None | Status: | Invalid |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Closed |
Thu 22 Jul 2010 11:09:39 PM UTC, comment #1: |
Eric Blake <ericb> |
Thu 22 Jul 2010 12:05:40 AM UTC, original submission:
Grep now seems to interpret \s in the regex as whitespace. This is
|
Gene Hightower <Digilicious> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2010-07-25 | bonzini | Status | None | Invalid | |
Open/Closed | Open | Closed | |||
Summary | Grep now seems to interpret \\s in the regex as whitespace | Grep now seems to interpret \s in the regex as whitespace | |||
2010-07-22 | ericb | Summary | Grep now seems to interpret \\s in the regex as whitespace | Grep now seems to interpret \s in the regex as whitespace |
Powered by Savane 3.13-f8d8.
Corresponding source code
Thanks for the report. However, \s is (intentionally) left unspecified by POSIX, so we are free to treat it as an extension. Basically, older grep treated '\s' as an extension for 's'; while newer grep treats it as an extension requesting '[[:space:]]'.
The change was intentional, as part of moving grep to be closer to glibc's regex engine, but you are correct that 2.6.3 failed to document it very well. However, this was rectified in git several days before your bug report:
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=3569576a3
If you want to match literal 's', use 's' rather than '\s' in the first place; by using an expression actually specified by POSIX, you will also make your grep usage portable to non-GNU versions of grep.