Re: WebDNA Grep help wanted
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 56185
interpreted = N
texte = Now that I think of it, you can also do a loop for all of the tags based on the number of levels of nested tags you expected. Thus, if you looped your existing code for a second repetition, it should catch the [b] in your example. Not an example of great coding but since this grep search=\[[bB]\]^(THE CLOSING TAG PATTERN THAT FOLLOWS*)\[/[bB]\]is unlikely to work, I thought I'd mention the option. Bill-----Original Message-----From: devaulw@onebox.comSent: Tue, 17 Feb 2004 16:09:21 -0500To:
(WebDNA Talk)Subject: Re: WebDNA Grep help wantedI see why you require pairs, but that makes the grep much harder because, in the example you give, the search ends at the first [ when it should end at the first [/b. One work-around is to try:grep search=\[([unurl]%5B[/unurl])(iIbB)\]&replace=<\1\2>I'm not completely sure of the sytax without testing, but the general idea is to match either [b] or [/b] to replace with or in the same expression so that each instance is treated and not a pair of tags. Another way might be to bypass the first [i but I don't know how to not match a pattern in grep, only single characters as you've done:grep search=\[[bB]\]([NOT THE CLOSING TAG PATTERN THAT FOLLOWS]*)\[/[bB]\]Bill-----Original Message-----From: Palle Bo Nielsen Sent: Tue, 17 Feb 2004 21:44:26 +0100To: (WebDNA Talk)Subject: WebDNA Grep help wantedHi all,I have a messageboard developed in WebDNA. The messageboard does not accept HTML syntax due to security. In stead I have made a parsingt system which translate forum specific tags to HTML behind the scenes.[/b]If I wanted to post a message in the forum with bold words it would look like this[/b][/i]If I wanted to post a message in the forum with italic words it would look like this[/i]The grep lines handling this process is pasted below, but it can't handle a line like this. And here I need some help...[b] this is a line of bold words including one word in [i]italic[/i], but it won't work - only the italic-tags are parsed correctly[/b]Any help is appreciated...----- code ----[!] -- REPLACE [b] WITH (ignore case) text [/!][text]the_text=[grep search=\[[bB]\]([^[unurl]%5B[/unurl]]*)\[/[bB]\]&replace=\1 b>][text]the_text[/text][/grep][/text][!] -- REPLACE [b] WITH (ignore case) text [/!][text]the_text=[grep search=\[[iI]\]([^[unurl]%5B[/unurl]]*)\[/[iI]\]&replace=\1 i>][text]the_text[/text][/grep][/text]----- code ----There are lots of other Greps parsing syntax but I only include the above for this example.Palle-------------------------------------------------------------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/-------------------------------------------------------------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:
Now that I think of it, you can also do a loop for all of the tags based on the number of levels of nested tags you expected. Thus, if you looped your existing code for a second repetition, it should catch the [b] in your example. Not an example of great coding but since this grep search=\[[bB]\]^(THE CLOSING TAG PATTERN THAT FOLLOWS*)\[/[bB]\]is unlikely to work, I thought I'd mention the option. Bill-----Original Message-----From: devaulw@onebox.comSent: Tue, 17 Feb 2004 16:09:21 -0500To: (WebDNA Talk)Subject: Re: WebDNA Grep help wantedI see why you require pairs, but that makes the grep much harder because, in the example you give, the search ends at the first [ when it should end at the first [/b. One work-around is to try:grep search=\[([unurl]%5B[/unurl])(iIbB)\]&replace=<\1\2>I'm not completely sure of the sytax without testing, but the general idea is to match either [b] or [/b] to replace with or in the same expression so that each instance is treated and not a pair of tags. Another way might be to bypass the first [i but I don't know how to not match a pattern in grep, only single characters as you've done:grep search=\[[bB]\]([NOT THE CLOSING TAG PATTERN THAT FOLLOWS]*)\[/[bB]\]Bill-----Original Message-----From: Palle Bo Nielsen Sent: Tue, 17 Feb 2004 21:44:26 +0100To: (WebDNA Talk)Subject: WebDNA Grep help wantedHi all,I have a messageboard developed in WebDNA. The messageboard does not accept HTML syntax due to security. In stead I have made a parsingt system which translate forum specific tags to HTML behind the scenes.[/b]If I wanted to post a message in the forum with bold words it would look like this[/b][/i]If I wanted to post a message in the forum with italic words it would look like this[/i]The grep lines handling this process is pasted below, but it can't handle a line like this. And here I need some help...[b] this is a line of bold words including one word in [i]italic[/i], but it won't work - only the italic-tags are parsed correctly[/b]Any help is appreciated...----- code ----[!] -- REPLACE [b] WITH (ignore case) text [/!][text]the_text=[grep search=\[[bB]\]([^[unurl]%5B[/unurl]]*)\[/[bB]\]&replace=\1 b>][text]the_text[/text][/grep][/text][!] -- REPLACE [b] WITH (ignore case) text [/!][text]the_text=[grep search=\[[iI]\]([^[unurl]%5B[/unurl]]*)\[/[iI]\]&replace=\1 i>][text]the_text[/text][/grep][/text]----- code ----There are lots of other Greps parsing syntax but I only include the above for this example.Palle-------------------------------------------------------------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/-------------------------------------------------------------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/
devaulw@onebox.com
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:
multi-paragraph fields (1997)
[username],[password] for [authenticate] (2001)
ANother SHOWIF problem (1997)
Likelihood of a duplicate (2005)
NY taxRates.db? (1997)
WebCat2: Formulas.db question (1997)
WebCat2b15MacPlugin - showing [math] (1997)
Enhancement Request for WebCatalog-NT (1996)
A question on sub-categories (1997)
WebCatalog/Mac 2.1b2 New Features (1997)
Sort Order on a page search (1997)
PCS Emailer's role ? (1997)
Major Security Hole (1998)
[WebDNA] WebDNA code validator (2011)
Sequential Code Logic (2003)
[Lookup] on secure page not returning anything (2000)
WebCat2 Append problem (B14Macacgi) (1997)
WebCatalog security on NT (2000)
File Uploads... (1997)
Configuring E-mail (1997)