Page 1 of 1

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

Posted: Sat Oct 01, 2005 12:13 am
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.

Posted: Sun Oct 02, 2005 4:00 pm
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 \|

Posted: Mon Oct 03, 2005 2:34 pm
by HHaynes
Excellent - turns out it was both config in AFR and my RE. Thanks!