Re: grep is really pathetic sometimes
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 51318
interpreted = N
texte = Hi John,I tried that same code:>> code:[Text show=T]SKU=TROUTPRINT.JPG[/Text]
[grepsearch=^([A-Z0-9][0-9A-Z])([0-9A-Z][0-9A-Z][0-9A-Z])&replace=\1/\2/][getchars start=1&end=5][SKU][/getchars][/grep]>> output:TROUTPRINT.JPGTR/OUT/Raj----- Original Message ----- From: "John Peacock"
To: "WebDNA Talk" Sent: Wednesday, June 25, 2003 2:10 AMSubject: RFE: grep is really pathetic sometimes> > I love using regular expressions to process my text (which is why I spendmost> of my time using Perl these days). However, one of my other developerscame to> me to ask why a particular grep was working the way it was.>> The code is as follows:>> [grep>search=^([A-Z0-9][0-9A-Z])([0-9A-Z][0-9A-Z][0-9A-Z])&replace=\1/\2/][getchars> start=1&end=5][SKU][/getchars][/grep]>> That *should* match the first two characters (as \1) and the next three(as \2).> It always seemed to work when we were only looking at numbers, but wehad to> extend it to work with characters as well as and it suddenly startedmatching> twice for one item.>> For SKU=TROUTPRINT.JPG, we expected it to return "TR/OUT/", but it wouldreturn> "TR/OUT/PR/INT" instead. It turns out that [grep] doesn't understand the> beginning of line (BOL) anchor "^" character. Consequently, the patternwas> matching twice (because this item had a longer SKU than the other items).This> is very annoying and vastly reduces the usabililty of [grep] for me.>> Why couldn't WebCat provide a real regex engine like Perl CompatibleRegular> Expressions:>> http://www.pcre.org/>> instead of whatever hodgepodge of code it currently has? At the veryleast,> WebCat should have thrown some sort of an error for the "^" which itdoesn't> understand.> >> John>> -- > John Peacock> Director of Information Research and Technology> Rowman & Littlefield Publishing Group> 4501 Forbes Boulevard> Suite H> Lanham, MD 20706> 301-459-3366 x.5010> fax 301-429-5748>>> -------------------------------------------------------------> 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/-------------------------------------------------------------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:
Hi John,I tried that same code:>> code:[Text show=T]SKU=TROUTPRINT.JPG[/Text]
[grepsearch=^([A-Z0-9][0-9A-Z])([0-9A-Z][0-9A-Z][0-9A-Z])&replace=\1/\2/][getchars start=1&end=5][SKU][/getchars][/grep]>> output:TROUTPRINT.JPGTR/OUT/Raj----- Original Message ----- From: "John Peacock" To: "WebDNA Talk" Sent: Wednesday, June 25, 2003 2:10 AMSubject: RFE: grep is really pathetic sometimes> > I love using regular expressions to process my text (which is why I spendmost> of my time using Perl these days). However, one of my other developerscame to> me to ask why a particular grep was working the way it was.>> The code is as follows:>> [grep>search=^([A-Z0-9][0-9A-Z])([0-9A-Z][0-9A-Z][0-9A-Z])&replace=\1/\2/][getchars> start=1&end=5][SKU][/getchars][/grep]>> That *should* match the first two characters (as \1) and the next three(as \2).> It always seemed to work when we were only looking at numbers, but wehad to> extend it to work with characters as well as and it suddenly startedmatching> twice for one item.>> For SKU=TROUTPRINT.JPG, we expected it to return "TR/OUT/", but it wouldreturn> "TR/OUT/PR/INT" instead. It turns out that [grep] doesn't understand the> beginning of line (BOL) anchor "^" character. Consequently, the patternwas> matching twice (because this item had a longer SKU than the other items).This> is very annoying and vastly reduces the usabililty of [grep] for me.>> Why couldn't WebCat provide a real regex engine like Perl CompatibleRegular> Expressions:>> http://www.pcre.org/>> instead of whatever hodgepodge of code it currently has? At the veryleast,> WebCat should have thrown some sort of an error for the "^" which itdoesn't> understand.> >> John>> -- > John Peacock> Director of Information Research and Technology> Rowman & Littlefield Publishing Group> 4501 Forbes Boulevard> Suite H> Lanham, MD 20706> 301-459-3366 x.5010> fax 301-429-5748>>> -------------------------------------------------------------> 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/-------------------------------------------------------------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/
"Rajeev Kumar"
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:
Show shoppingcart after remove last item (1997)
Problems with ^ could be solved with [REPLACE CHARACTERS] (1997)
Set Line Item (1999)
PCS Frames-Default page is solution! (1997)
Nested tags count question (1997)
WebCatalog dying in WebTen Revisited (1998)
[WriteFile] problems (1997)
Closing Databases (1998)
OFF TOPIC: help wanted (1997)
Feature Request (2003)
Using Applescript to process WebCatalog functions (1998)
Maybe off topic but how to charge (1997)
WC Database Format (1997)
OFF-TOPIC: Free webdna.net email addresses ... (2003)
Word Break (1999)
sku not found (1997)
WebCat2: multiple currency support (1997)
Email Set-Up? (1997)
[WebDNA] Screen Resolution - detection & redirect (2012)
Custom formulas.db (1998)