List Info

Thread: negating a word




negating a word
user name
2006-11-15 19:37:25
Using grep, I want to do something like this:

(hello).*foobar

...which means, find all lines that have "foobar"
as long as it is not
preceded somewhere with the word "hello."  I can't
get that to work.
What am I doing wrong?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

negating a word
user name
2006-11-19 01:57:18
#!/usr/bin/perl -w
use strict;
open FILE, "name of the file";
while(<FILE>){ print $_ if /(?<!hello)foobar/};
close FILE;

Do it with perl


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )