Topic awaiting preservation: More Regexp Mania!!!!! (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 10-03-2001 17:37
Okay, so I want to find the first line that doesn't start with a certain word. I know you can use negative classes [^things] to match a character that isn't in a predetermined set. The question: |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-03-2001 22:18
In newer versions of PERL, regular expressions have support for lookbehind & lookahead assertions, which in combination with multiline modifier can probably do what you want (but not in Vi)... Here's a brief explanation of lookbehind assertions (copy pasted from PCRE manual): |
Paranoid (IV) Inmate From: Madison, Indiana, USA |
posted 10-04-2001 06:20
jiblet: You say you are doing this in VI. Why don't you use :g/^coffman\>/d to delete all lines in the file that start with the word 'coffman'. |
Bipolar (III) Inmate From: USA! USA! USA! |
posted 10-10-2001 22:28
Since your logic is fairly simple, you needn't worry about negative look-aheads and all that stuff: code: if(!/^coffman/i.test(lineFromLog)){
|
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 10-15-2001 15:53
OOpz, my response never made it. |