Re: Grep question [parsing variables] problem
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 47287
interpreted = N
texte = Palle Bo Nielsen wrote:> Hi John,> > Well it should have stated...> > this is a test [b]with bold [i]and bold italic[/i] words[/b]> > My bad when I wrote the mail to the list... but it still don't work...Nor should it. You will have to replace the nested context first, or else it will not work. In general, you will be unable to use grep to manage nested search and replace; you really need to use a finite state machine to do this in a consistent way. Here's why:> > [!] -- REPLACE [b] WITH
(ignore case) text [/!]> [text]set_main_txt=[grep > search=\[[bB]\]([^[unurl]%5B[/unurl]]*)\[/[bB]\]&replace=\1 > b>][text]set_main_txt[/text][/grep][/text]This part of the regex: \[[bB]\]([^[unurl]%5B[/unurl]]*)matches this part of the original text: [b]with bold [but since there isn't an immediately trailing [/b], the search fails and hence the replace never happens.You will have to do 4 searchs: 1 for each leading and trailing tag:[text]set_main_txt=[grep search=\[[bB]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[/[bB]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[[iI]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[/[iI]\]&replace=[text]set_main_txt[/text][/grep][/text]However, this would still not _disply_ correctly if, as you originally posted, one of the closing tags was missing (the rest of the page would be boldface).HTHJohn-- 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:
Palle Bo Nielsen wrote:> Hi John,> > Well it should have stated...> > this is a test [b]with bold [i]and bold italic[/i] words[/b]> > My bad when I wrote the mail to the list... but it still don't work...Nor should it. You will have to replace the nested context first, or else it will not work. In general, you will be unable to use grep to manage nested search and replace; you really need to use a finite state machine to do this in a consistent way. Here's why:> > [!] -- REPLACE [b] WITH (ignore case) text [/!]> [text]set_main_txt=[grep > search=\[[bB]\]([^[unurl]%5B[/unurl]]*)\[/[bB]\]&replace=\1 > b>][text]set_main_txt[/text][/grep][/text]This part of the regex: \[[bB]\]([^[unurl]%5B[/unurl]]*)matches this part of the original text: [b]with bold [but since there isn't an immediately trailing [/b], the search fails and hence the replace never happens.You will have to do 4 searchs: 1 for each leading and trailing tag:[text]set_main_txt=[grep search=\[[bB]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[/[bB]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[[iI]\]&replace=[text]set_main_txt[/text][/grep][/text][text]set_main_txt=[grep search=\[/[iI]\]&replace=[text]set_main_txt[/text][/grep][/text]However, this would still not _disply_ correctly if, as you originally posted, one of the closing tags was missing (the rest of the page would be boldface).HTHJohn-- 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:
Problem during evaluation of WebCatalog (1998)
Robust WebDNA Job Manager / Accountant (2006)
FlushDatabase Suggestion (1998)
[WebDNA] FedEx (2016)
database freeze (1997)
[OT] Am I an Idiot? (2004)
WebCat2.0 acgi vs plugin (1997)
Help with sorting search results sorting (1998)
It finally happened ... (2003)
[OT] MacOs IE5 topmargin and leftmargin bug (2000)
Emailer prefs in two places ... (1997)
RE: [WebDNA] WebDNA Hosts (2009)
Summing fields (1997)
Leading reasons for TCPConnect randomly failing? (1999)
How can I record purchases to a database? (1998)
Webstar 1.3.1 PPC (1997)
simple answer? [hideif] (1997)
[WebDNA] WebDNA [sendmail] - fixes and future features (2010)
WebCat2 beta 11 - new prefs ... (1997)
Thanks ! (1997)