Re: Using grep to parse Canadian Postal Codes

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 45691
interpreted = N
texte = Dennis J. Bonsall, Jr. wrote: > Here is the grep string I am using: > > [grep > search=([^a-zA-Z][^0-9][^a-zA-Z][^0-9][^a-zA-Z][^0-9])&replace=\1_][zip_][/grep]You are missing the point of [grep], which takes a search string and only fires the replacement if a portion of the string _matches the entire search_ in the first place. You cannot use it in a negative search like that.Try doing it this way instead:[text]testzip=[zip_][/text] [grep search=([a-zA-Z][0-9][a-zA-Z][0-9][a-zA-Z][0-9])&replace=OK_CAZIP][testzip][/grep][showif [testzip]=OK_CAZIP] [!]whatever you want to happen[/!] [/showif]John-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747 ------------------------------------------------------------- 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:

    
  1. Re: Using grep to parse Canadian Postal Codes (John Peacock 2002)
  2. Using grep to parse Canadian Postal Codes (Dennis J. Bonsall, Jr. 2002)
Dennis J. Bonsall, Jr. wrote: > Here is the grep string I am using: > > [grep > search=([^a-zA-Z][^0-9][^a-zA-Z][^0-9][^a-zA-Z][^0-9])&replace=\1_][zip_][/grep]You are missing the point of [grep], which takes a search string and only fires the replacement if a portion of the string _matches the entire search_ in the first place. You cannot use it in a negative search like that.Try doing it this way instead:[text]testzip=[zip_][/text] [grep search=([a-zA-Z][0-9][a-zA-Z][0-9][a-zA-Z][0-9])&replace=OK_CAZIP][testzip][/grep][showif [testzip]=OK_CAZIP] [!]whatever you want to happen[/!] [/showif]John-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747 ------------------------------------------------------------- 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/ John Peacock

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:

WebCatalog can't find database (1997) Security for malls with different webmasters (1998) Add command creates new cart but I'm passing existing cart...? (2000) Variable prices and Formulas.db (1997) Chown www:wheel Almost There WebCat 5 on itools 7 (2003) Server IP address-thanks (2004) WC 2.0 frames feature (1997) Hierarchy of form/text/math variables (2000) Emailer Error 550 (Was Strange Crash) (1998) WebCatalog NT beta 18 now available (1997) WebCat2 - Getting to the browser's username/password data (1997) E-mailer error codes (1997) Help Wanted - Stowe, Vermont (1999) Can a database get stomped by simultaneous access? (1997) Formating Tables w/[founditems] (1998) upgrading (1997) PageMaker/Quark to db (1999) [WebDNA] FCGI Error/Bug (2020) Parsing webdna variable to javascript (2005) Quit revisited (1997)