Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jon Woolf
  Where is Jon Woolf?
 Wilton
 New Hampshire - United States
 Jon Woolf
 Tags
Subject: Regular expressions in VFP?
Thread ID: 289325 Message ID: 289325 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Thursday, December 30, 2010 8:51:05 PM         
   


Is there a way to do regular-expression checks in VFP? Specifically, I have a table which contains a 'postal code.' This code might be:

* a US old-style zip code, 5 digits NNNNN
* a new-style US zip code, 5-4 digits, NNNNN-NNNN
* a Canadian postal code, LNL NLN (where L = any letter, N = any digit)
* a UK postal code, Lxxx NLL (L = letter, N = digit, x can be either)

and possibly others.

I currently have a block of code that parses the 'postal code' field character by character and decides what it is based on the results, but this code is slow and ugly and hard to enhance with new post-code forms. Is there a quicker, cleaner way to do it?

-- Jon W.

ENTIRE THREAD

Regular expressions in VFP? Posted by Jon Woolf @ 12/30/2010 8:51:05 PM
RE: Regular expressions in VFP? Posted by Cetin Basoz @ 12/30/2010 10:38:18 PM
RE: Regular expressions in VFP? Posted by Michel Levy @ 12/31/2010 8:44:54 AM