I have a config file with the format: key1 = value1 key2 = value2 #intentional whitespace for example and I try to use grep (2.5.1a-r1) to check if certain keys exist with the following command: grep '\s*key1\s*=' config.file So in english, any whitespace, key, any whitespace, equals character This does not work (it fails to recognize a line which should match). However changing the regex to: grep '\s*key1\s*=*' config.file Does work. If I try the former regex on fedora (grep 2.5.1) it matches the pattern correctly. Reproducible: Always Steps to Reproduce: 1. Create a text file with a line like "gentoo = great" (without quotes) 2. grep '\s*gentoo\s*=' filename 3. grep '\s*gentoo\s*=*' filename Actual Results: step two will not produce a match, while step three will
\s matches the lowercase letter s. To match a space character, use [[:space:]] or list the specific literal characters between [ and ]. There is no mention in the documentation of any special behaviour for \s. If Fedora's grep behaves differently, maybe they patched it, but a manually compiled grep without any patches behaves the same way for me as Gentoo's grep does. And the reason \s*gentoo\s*=* does match your string is because it matches just "gentoo", since both the trailing letters 's' and the = are optional.