Why is negation of a regex needed?

Posted by Lazer on Stack Overflow See other posts from Stack Overflow or by Lazer
Published on 2010-05-23T06:43:40Z Indexed on 2010/05/23 6:50 UTC
Read the original article Hit count: 1013

Filed under:
|

There are so many questions on regex-negation here on SO.

I am not sure I understand why people feel the need to negate a regex. Why not use something like grep -v that shows only the results that do not match the regex?


$ ls
april  august  december  february  january  july  june  march  may  november  october  september
$ ls | grep ber
december
november
october
september
$ ls | grep -v ber
april
august
february
january
july
june
march
may

© Stack Overflow or respective owner

Related posts about regex

Related posts about regex-negation