Using RE to find and replace any ZIP code - but is inserting

General discussions about Advanced Find and Replace
Post Reply
HHaynes
Posts: 2
Joined: Sat Oct 01, 2005 12:07 am

Using RE to find and replace any ZIP code - but is inserting

Post by HHaynes »

Hi - I'm having a heckuva time getting a regular expression to actually replace a ZIP code in a file. So far, I've only managed to insert the desired ZIP, so now my file is invalid for my parser.

Example:

Starting value: ZipCode|06472

Batch replace: Search For:
ZipCode|/d

Replace With:
ZipCode|77625

Actual Output:
ZipCode|77625|06472

I'm not sure if there's something wrong with the structure of the regular expression or if it's a setting in AFR. Thanks in advance.

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

Post by Abacre »

Hi,

As far as I understood
you need to replace ZipCode|anynumber
by ZipCode|77625
right?

Use the following:

Go to main menu - Action - Options - Batch replace
check ON "Modifier G".

In main window of the program:
Go to Batch replace, check on "Use regular expressions".

Search for:
ZipCode\|\d+

Replace with:
ZipCode|77625

That's all.

Explanations:
any number: \d
any numbers: \d+
| is reserved char, so we should escape it by using \|
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

HHaynes
Posts: 2
Joined: Sat Oct 01, 2005 12:07 am

Post by HHaynes »

Excellent - turns out it was both config in AFR and my RE. Thanks!

Post Reply