Re: Question about replacing words

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19665
interpreted = N
texte = >>Only one problem, I'm still not clear on how using the new [listwords] and >>[countwords] contexts is going to help me perform a simple text string >>replacement. Will you please post an example of the webdna code we can use >>to perform this task in version 3.x? > >[ListWords words=Hello there, my name is John&delimiters=%20] >[ShowIf [word]=John]Grant [/ShowIf] >[HideIf [word]=John][word] [/HideIf] >[/ListWords] Hi Grant,Thanks for the example, but I've been thru this already. I checked this all out a couple of months ago when you first mentioned this new [listwords] context ... because I was really excited to think that I might *finally* have the tools I needed to replace text strings on the fly with WebCatalog!Unfortunately, I am still convinced that the kind of text string replacement we (as webcat users) need to perform on a regular basis is still not possible with webcatalog. Even using all the new tools you've added to 3.x, it's still impossible to perform a simple text string replacement -- for the following reasons and possibly others ...1- Your example code adds a space to the original text string where there was none to begin with ... thus the resulting output text will not be the same as what was originally entered. Modification of any text *other than* the match string is obviously not an acceptable side effect of performing this replacement task. We don't want to change anything *except* the character strings we choose to have changed ...2- Your example defines there, as a word ... but we all know that there is a word and , is a punctuation mark, and that's how they need to be treated. If we use your example to attempt to replace the word there (instead of replacing John) it would fail to be replaced because the listwords context does not list there as a word ... it lists there, as a word instead ... :(To replace a matching string of characters, all we should really have to do is define the exact string of characters that need to be matched. Then webcat should look for that string and replace it -- that's all. We really should not have to try to figure out how to define the correct delimiters in listwords every time just to get it to work properly in all situations. It won't work most of the time anyways, for the following reasons ...3- To work around the problem of #2 above, one might think that defining , as a delimiter would solve the problem -- but it won't -- because as soon as we define that comma as a delimiter, it gets removed from the resulting output text. And that means it cannot be 'put back' into the same position it was removed from -- because once it's gone, it's gone forever. That's why you have placed a space after Grant and [word] in your showif and hideif above ... so the delimiters (which are defined as spaces) will be replaced in the output text after being removed by the listwords context.And a comma is only one of several punctuation marks a visitor might enter immediately next to a 'real' word when typing text into a form field. So if we must define ALL the common keyboard character someone might place next to a 'real' word, such as ' , . - ( ) [] { } & $ ! ? > < : ; then all those characters will be missing from the resulting output text -- and that completely destroys the original sentence structure. See what I'm getting at here?I think it's great that you've given us this awesome listwords context, and I'm sure it may some in handy for some of us one day, but I still cannot see how it can be used to perform a simple match string replacement.So far, I've only mentioned the simple case of replacing a *single word* using your listwords example. But what happens when we need to replace a string of characters that happens to have one of our defined delimiters in it?The listwords context separates the original text at every defined delimiter it sees -- there's no way around that. So we still have no way to replace the string is John with was Grant in your example above, because listwords will separate is John into is and John -- and neither of these will match the is John string we actually need to replace.I believe you've done exceptional work to create a listwords context, and unfortunately I also see it as a tool that currently cannot help us when we need to replace a specific match string with a different string of characters -- it's just not designed for this task.What we really need is a tool that's designed specifically to replace a character string with a replacement string -- with optional case matching ...Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net Associated Messages, from the most recent to the oldest:

    
  1. Re: Question about replacing words (Peter Ostry 1998)
  2. Re: Question about replacing words (Kenneth Grome 1998)
  3. Re: Question about replacing words (Grant Hulbert 1998)
  4. Re: Question about replacing words (Peter Ostry 1998)
  5. Re: Question about replacing words (Kenneth Grome 1998)
  6. Re: Question about replacing words (Peter Ostry 1998)
  7. Re: Question about replacing words (PCS Technical Support 1998)
  8. Re: Question about replacing words (Kenneth Grome 1998)
  9. Re: Question about replacing words (Grant Hulbert 1998)
  10. Re: Question about replacing words (Kenneth Grome 1998)
  11. Re: Question about replacing words (Kenneth Grome 1998)
  12. Re: Question about replacing words (Kenneth Grome 1998)
  13. Re: Question about replacing words (Grant Hulbert 1998)
  14. Re: Question about replacing words (Christer Olsson 1998)
  15. Re: Question about replacing words (Alex McCombie - New World Media 1998)
  16. Re: Question about replacing words (Alex McCombie - New World Media 1998)
  17. Re: Question about replacing words (Dave MacLeay 1998)
  18. Re: Question about replacing words (Christer Olsson 1998)
  19. Re: Question about replacing words (Kenneth Grome 1998)
  20. Re: Question about replacing words (Alex McCombie - New World Media 1998)
  21. Re: Question about replacing words (PCS Technical Support 1998)
  22. Re: Question about replacing words (PCS Technical Support 1998)
  23. Re: Question about replacing words (Alex McCombie - New World Media 1998)
  24. Question about replacing words (Alex McCombie - New World Media 1998)
>>Only one problem, I'm still not clear on how using the new [listwords] and >>[countwords] contexts is going to help me perform a simple text string >>replacement. Will you please post an example of the webdna code we can use >>to perform this task in version 3.x? > >[ListWords words=Hello there, my name is John&delimiters=%20] >[ShowIf [word]=John]Grant [/ShowIf] >[HideIf [word]=John][word] [/HideIf] >[/ListWords] Hi Grant,Thanks for the example, but I've been thru this already. I checked this all out a couple of months ago when you first mentioned this new [listwords] context ... because I was really excited to think that I might *finally* have the tools I needed to replace text strings on the fly with WebCatalog!Unfortunately, I am still convinced that the kind of text string replacement we (as webcat users) need to perform on a regular basis is still not possible with webcatalog. Even using all the new tools you've added to 3.x, it's still impossible to perform a simple text string replacement -- for the following reasons and possibly others ...1- Your example code adds a space to the original text string where there was none to begin with ... thus the resulting output text will not be the same as what was originally entered. Modification of any text *other than* the match string is obviously not an acceptable side effect of performing this replacement task. We don't want to change anything *except* the character strings we choose to have changed ...2- Your example defines there, as a word ... but we all know that there is a word and , is a punctuation mark, and that's how they need to be treated. If we use your example to attempt to replace the word there (instead of replacing John) it would fail to be replaced because the listwords context does not list there as a word ... it lists there, as a word instead ... :(To replace a matching string of characters, all we should really have to do is define the exact string of characters that need to be matched. Then webcat should look for that string and replace it -- that's all. We really should not have to try to figure out how to define the correct delimiters in listwords every time just to get it to work properly in all situations. It won't work most of the time anyways, for the following reasons ...3- To work around the problem of #2 above, one might think that defining , as a delimiter would solve the problem -- but it won't -- because as soon as we define that comma as a delimiter, it gets removed from the resulting output text. And that means it cannot be 'put back' into the same position it was removed from -- because once it's gone, it's gone forever. That's why you have placed a space after Grant and [word] in your showif and hideif above ... so the delimiters (which are defined as spaces) will be replaced in the output text after being removed by the listwords context.And a comma is only one of several punctuation marks a visitor might enter immediately next to a 'real' word when typing text into a form field. So if we must define ALL the common keyboard character someone might place next to a 'real' word, such as ' , . - ( ) [] { } & $ ! ? > < : ; then all those characters will be missing from the resulting output text -- and that completely destroys the original sentence structure. See what I'm getting at here?I think it's great that you've given us this awesome listwords context, and I'm sure it may some in handy for some of us one day, but I still cannot see how it can be used to perform a simple match string replacement.So far, I've only mentioned the simple case of replacing a *single word* using your listwords example. But what happens when we need to replace a string of characters that happens to have one of our defined delimiters in it?The listwords context separates the original text at every defined delimiter it sees -- there's no way around that. So we still have no way to replace the string is John with was Grant in your example above, because listwords will separate is John into is and John -- and neither of these will match the is John string we actually need to replace.I believe you've done exceptional work to create a listwords context, and unfortunately I also see it as a tool that currently cannot help us when we need to replace a specific match string with a different string of characters -- it's just not designed for this task.What we really need is a tool that's designed specifically to replace a character string with a replacement string -- with optional case matching ...Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net Kenneth Grome

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:

Setting the Date (2000) allow or deny based on referer.... (1997) ReturnRaw context (1997) Triggers (2004) [WebDNA] [Orderfile] problem (2009) Browser Detection (2002) emailer w/F2 (1997) WebCat2 Append problem (B14Macacgi) (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) [WebDNA] .htm files (2008) Protect (1997) [GROUPS] followup (1997) Secure Server (1999) 2.0Beta Command Ref (can't find this instruction) (1997) denied access (1997) Security Hole - NetCloak Update (1998) Hard Questions ? (1997) [shownext max=?] armed (1997) Errata: WCS Newbie question (1997) question: webmerchant connection (1997)