[linux-help] Re: Regexp question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Is this a perl regexp? If so you can use !~ to invert a regexp. So you
could do:
if ($var !~ m/foobar.*/)
That would be true only if $var does not match m/foobar.*/
If you are using a regexp with grep on the command line, you can do a
similar thing with the -v option.
grep -v 'foobar.*' file
That will return all lines in the file that do not match foobar.*
Is that what you are after?
On Fri, Nov 10, 2000 at 05:24:56PM -0600, Jesse Kaufman wrote:
> Ok, I'm trying to get a regexp working to do the following:
>
> match anything that does not match /foobar.* and return it (ie: using
> "()"'s)... how would someone go about negating an entire regexpression
> (if that's what you'd call it..)?
>
> ie:
>
> "/foobar/blah" would match the above
> "/foobar" would match the above
> "/test" would not, and "/test" would be returned
>
> thanks,
> gLaNDix
>
> --
> Jesse Kaufman | WebSurf Internet Access
> Administration / Web Development | www.websurf.net
> glandix@xxxxxxxxxxx | Ph: 316.945.7873
> www.linuxfreak.com/~glandix | Fax: 316.946.9944
> --
>
> <<< Vim is a REAL man's text editor. I don't know why anyone else would
> even bother with sissy programs like emacs, or even worse... pico! >>>
>
>
>
> -- This is the linux-help@xxxxxxxxx list. To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|