Complete.Org: Mailing Lists: Archives: linux-help: November 2000:
[linux-help] Re: Regexp question
Home

[linux-help] Re: Regexp question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: linux-help@xxxxxxxxx
Subject: [linux-help] Re: Regexp question
From: Steven Saner <ssaner@xxxxxxxxxxxxxxx>
Date: Sat, 11 Nov 2000 12:05:44 -0600
Reply-to: linux-help@xxxxxxxxx

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


[Prev in Thread] Current Thread [Next in Thread]