Want to delete an entire line if an item is found

General discussions about Advanced Find and Replace
Post Reply
darren

Want to delete an entire line if an item is found

Post by darren »

Hello,

I want to search for a word and delete the entire line if the word is found. Please let me know how to do that.

Thanks!

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Read the page with exact answer:
http://www.abacre.com/afr/manual/regexpfaq.htm

Darren

Re: Want to delete an entire line if an item is found

Post by Darren »

darren wrote:Hello,

I want to search for a word and delete the entire line if the word is found. Please let me know how to do that.

Thanks!


Thanks very much for the speedy response! I still have two issues. In the example that you answered with, it does not do all that it states. If you try it, it deletes all of the first two lines but not all of the last occurance. Strange.

Also, on my issue, here is the example:

<html>
<head>
<title>John Doe</title>
</head>
<BODY BACKGROUND=back.gif TEXT=#000000 LINK=#0000ff>
<CENTER><TABLE WIDTH=550 border=0><TR><TD><center>
<h1>John Doe</h1>
</center>
<hr size=7 width=95%>

I use john.*\r\n and it does not do anything when executed.

Thanks!

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Try this:

^.*john.*\r\n

so:
^ means start of the line
.* - any char

Post Reply