Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Jon Woolf
  Where is Jon Woolf?
 Wilton
 New Hampshire - United States
 Jon Woolf
 Tags
Subject: RE: Regular expressions in VFP?
Thread ID: 289325 Message ID: 289328 # Views: 60 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Thursday, December 30, 2010 10:38:18 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.

Take a look at this message for a sample:

https://www.foxite.com/archives/0000223961.htm

Patterns can be found on internet. For example from .Net US Zip code (old and new with optional part):

\d{5}(-\d{4})?

Cetin Basoz

.Net has got better.Think about moving - check my blog:
Blog (main)
Blog (mirror)

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