regex how to match a line that doesn't have a certain char string

  • Thread starter Thread starter larry
  • Start date Start date
L

larry

I guess I'm missing some obvious stuff.
But I'm having trouble doing the following:

Delete all lines of text that does not contain "myString".

Any help would be appreciated.

Thanks
 
larry said:
I guess I'm missing some obvious stuff.
But I'm having trouble doing the following:

Delete all lines of text that does not contain "myString".

Try replacing: "(^.*myString.*$)|(^.*$)" with "$1", that should delete all
lines but the ones containing "myString". (use RegexOptions.Multiline, so ^
and $ match for start/end of lines)

Niki
 
Back
Top