On 2019-08-28 3:16 am, ak...@free.fr wrote:
Hi,
I encounter some problem with grep option -E on cygwin 3.0.7


echo "a^b" | grep "a^b" #answer a^b ie it's OK
but
echo "a^b" | grep -E "a^b" #answer nothing " for me it's KO


I have to backslash ^ to be OK like : grep -E 'a\^b'


Is-it a bug ?
I don't know if all versions of cygwin and grep are concerned.

Hi Akiki. As others mentioned, it has to do with how regular expressions operate. However the best solution for you in this situation is to not use regular expressions. To search for fixed strings, use fgrep or grep -F. That avoids all issues with meta characters and covers the vast majority of cases when we use grep anyway.

To use full power regular expressions read perlre and use grep -P.


Thanks.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to