Using grep to parse Canadian Postal Codes
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 45682
interpreted = N
texte = I am attempting to use WebCat's [grep] context to parse through a stringto verify whether or not the string _could_ be a Canadian Postal code.I have already used grep to remove all characters except numbers andletters from a string, and am left with a 6 character string. I simplyneed to verify that the string is in the format of
, such as A1A1A1.Here is the grep string I am using:[grepsearch=([^a-zA-Z][^0-9][^a-zA-Z][^0-9][^a-zA-Z][^0-9])&replace=\1_][zip_][/grep]I assume that it is simply running the entire string through eachbracket in the search. My intention is to run the first characterthrough the first bracket in the equation, the second through the secondand so on. Here's what passes through the above equation:A1A1A1 (as it should)111111 (this should fail)AAAAAA (this should also fail)What fails is:1A1A1A (as it should)If anyone can point me in the correct direction, I would beappreciative.Thanks,Dennis-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
I am attempting to use WebCat's [grep] context to parse through a stringto verify whether or not the string _could_ be a Canadian Postal code.I have already used grep to remove all characters except numbers andletters from a string, and am left with a 6 character string. I simplyneed to verify that the string is in the format of, such as A1A1A1.Here is the grep string I am using:[grepsearch=([^a-zA-Z][^0-9][^a-zA-Z][^0-9][^a-zA-Z][^0-9])&replace=\1_][zip_][/grep]I assume that it is simply running the entire string through eachbracket in the search. My intention is to run the first characterthrough the first bracket in the equation, the second through the secondand so on. Here's what passes through the above equation:A1A1A1 (as it should)111111 (this should fail)AAAAAA (this should also fail)What fails is:1A1A1A (as it should)If anyone can point me in the correct direction, I would beappreciative.Thanks,Dennis-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Dennis J. Bonsall, Jr.
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Closing Databases (1998)
WebCat2 - many [carts] on one template page? (1997)
multi-paragraph fields (1997)
WC2f3 (1997)
Bug? (1997)
Browser Resolution (1999)
question: back button prevention (1997)
Running 2 two WebCatalog.acgi's (1996)
RE: Can a database get stomped by simultaneous access? (1997)
math a various prices (1997)
WebCat2b13MacPlugin - [math][date][/math] problem (1997)
Question about replacing words (1998)
unsubscribe (1997)
Modifying order output (1997)
feature request 4.5 or 5 (2001)
Re[2]: Emailed problem (2000)
WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997)
[Announce] Newest Commerce Site based on WebCatalog (1997)
Search results templates (1996)
action= usage (2005)