Delete similiar instance of text string, but retain other

General discussions about Advanced Find and Replace
Post Reply

Delete similiar instance of text string, but retain other

Post by Ham66 » Mon Jan 31, 2005 5:32 pm

I have no experince with using search strings, so I apologize in advance for my ignorance.

In the example below, I need to search for and delete any strings similiar to the "1 EA 4.25" on line three, with the only consant being the "EA". The "1" and the "4.25" may be any value. (Application will be tab delimited text files.)

The trouble I've had is that AFR also finds the first instance of "EA" on lines one, two and four.... text I want to retain, and deletes it. The instances I want to retain will never have values on either side of them.

How should the search language read? Thanks.

Code: Select all

2   1   EA   44985017   TROUGH WDMT-FINES, CROSS (4800 MS)          
3   1   EA   44986017   AUGER WDMT-FINES, CROSS (4800 MS)          
4   4   IN   00643019   KEYSTOCK-1018 CD STL, 0.19 X 0.25   1 EA  4.25      
5   4   EA   00160009   LKWASH-SPR,HLCL,STL,METRIC,M 8          

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

Post by Abacre » Mon Jan 31, 2005 5:32 pm


Yes, this is a usual task for AFR.

In your message you gave a sample code (source code) but could you
also give a resulting code? (What should it be after replacements).

Here are some tips:

In order to remove a whole line. "1 EA 4.25"

Search for:

Here are:
^ - begin of line.
.*? - any char in non greedy mode.
\r\n - end of line (not you may have \r or \n as new lines. In Windows
files usually it's \r\n)

So resulting file will be:

Code: Select all

5   4   EA   00160009   LKWASH-SPR,HLCL,STL,METRIC,M 8

Note that main menu Action - Options - Batch:
Modifier M: ON
Modifier I: ON
Modifier S: OFF
Modifier G: ON

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests