Eudora Tip #200/08-Oct-2003
Matching Zip Codes
Bob Williams continues his Tip for using Regular Expressions. The next Tip will bring the remaining Example.
Example 3
For our final example, let’s say that we’re a real estate agent in the great city of Phoenix (where I happen to reside). On our web site is a form where our company’s clients supply the address of a house they’re interested in looking at, which is then e-mailed to all the agents within the company. Here’s the tricky part: though we receive all the messages, we’re only responsible for handling those properties that are new, and that are in a particular range of zip codes (85010 to 85049) representing one part of the city. Assuming that messages are flagged in the same way every time, Eudora’s conventional filter match criteria can easily handle the requirement of only catching new properties, but what about that zip code requirement? We have to cover 35 zip codes, but we don’t want to set up 35 filter criteria (which, with Eudora’s limit of just two criteria per filter, would mean we’d have to set up a whopping 18 filters just for this one task!). Nor do we want to do something like match “850″ in a message, since that could result in a lot of false hits. The solution, of course, is a regular expression.
The expression we want is: 850[1-4][0-9]
This tells Eudora to look for the string ‘850′ followed by a digit in the range of one to four, followed by a digit in the range of zero to nine. If the messages often have long strings of numbers, we might want to expand our expression to “[^0-9]850[1-4][0-9][^0-9]“. Here, we’ve added a sub-expression to the beginning and end of our previous expression that tells Eudora that our zip code cannot be immediately preceded nor followed by a number, which means our zip code will have to stand on its own, and not as part of a longer string of numbers. If we wanted, we could make this even smarter, by, for example, requiring a space before and a period after, depending on the nature of the messages we’re filtering.
Robert E. Williams, Jr.
President, TriVectus, LC www.trivectus.com
Visit our site to learn about our web consulting services, and to download our freeware and shareware software and desktop pictures. Also, be sure to sign up for our new newsletter, Overture, which will help you increase your site’s ROI.
If you’ve found this Part Three useful please visit Bob’s website and be sure to read Part Four next week. Note that last week’s Tip could be improved on. Christopher Stone kindly pointed out how and his suggestion has been added as a comment at the web archive. Be sure to check it out and remember that if you have comments you can add them at the archive.
Related Posts
- Matching City Names Eudora Tip #201/15-Oct-2003 Matching City Names Bob Williams brings us...
- Matching Joe Cool 2 Eudora Tip #199/01-Oct-2003 Matching Joe Cool 2 Bob Williams continues...
- Matching Joe Cool Eudora Tip #198/24-Sept-2003 Matching Joe Cool In previous Tips (search...
- Commercial DVDs and Region Codes Information and explanations about DVD region codes. ...
- You mean a filter can do that? You mean a filter can do that? Eudora Tip #31/22-April-2000...
Hey. Welcome back. Sign up for free MacTips updates via RSS or email, follow MacTips on Twitter and check our YouTube channel. Check for more Tips on this topic. We love your Comments too.


