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 PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4720 Boston WayLanham, MD 20706301-459-3366 x.5010fax 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:
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 PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4720 Boston WayLanham, MD 20706301-459-3366 x.5010fax 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:
New Command prefs ... (1997)
WebDNA 5.1 is now available! (2003)
-REPOST- WebCat 3 & Aliases (2000)
Macauth: Dates and No Scripting... (1997)
how do I delete 1 of 2 identical records? (2003)
Bit off subject -- Faxing orders (1997)
[url] (1997)
[OT] Xserve question (2004)
searching twice on same field (1998)
Major Security Hole (1998)
A workaround for handling date range search in yyyy/mm/dd form (1997)
RSS Feeds; basic info (2005)
Summing fields (1997)
[search] within [listfiles]? (2003)
Bug (feature) in v6 listfiles shows hidden files ... (2004)
item sorting (1997)
Sorting Numbers (1997)
includes and cart numbers (1997)
RE: Cart Template (1997)
Date search - yes or no (1997)