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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top