regular expression question



Sorry, this is probably silly question, but I cannot find right
answer.

I am trying to use grep -P (for perl regular expressions). I want to
match lines that do not contain the chars "sync".

I thought I could do:

grep -P "[^(sync)]" mytextfile

I understand [] matches any char in the brackets and (sync) groups
those chars together, so I would negate to mean should not match those
chars.

This is return all lines in the file. I am doing something wrong, just
do not know what. Can someone explain, please?
.



Relevant Pages

  • Re: regular expression question
    ... match lines that do not contain the chars "sync". ... you would negate the test: ... but that won't work as an option for grep. ... the word "sync". ...
    (comp.lang.perl.misc)
  • Re: [SLE] grep
    ... > Wonder if someone could give me the way to grep for an word within all ... > files on my system like the filename would be XXXX.XX ... will do a case insensitive file match for all files with 4 chars ...
    (SuSE)
  • Re: regular expression question
    ... I am trying to use grep -P (for perl regular expressions). ... match lines that do not contain the chars "sync". ... switch, so I can't tell how to use it. ...
    (comp.lang.perl.misc)
  • Re: findstr doesnt always find
    ... properly handled search strings longer than 115+ chars. ... so I'll see how its grep holds up. ...
    (microsoft.public.win2000.cmdprompt.admin)