Re: [WebDNA] remove html comments

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 101818
interpreted = N
texte = Owkaye Go wrote: >> (just under 800 lines) and used: >> and it successfully parsed out all the > > I think you say is correct and original answer > wrong. I will test and report my results. Can you > explain why .* is fail but [^-]* success? I didn't say it was correct, I said it will work most of the time. In the "second answer", we are looking for a string match that starts with and does not have "-" in between it. So it will fail, for example, with nested comments, or comments that contain a dash for some reason, or perhaps other formats. However, it is probable that it will work for most people, most of the time. If you are one that uses "-" as a convention in comments, you will have to change the code. Regarding why .* fails, I don't know exactly. traditionally the "." character doesn't work past lines and the "*" character is "greedy" (you'll have to look that up, because this is not a regular expression forum). So, the .* should not work at all for this purpose. However, since WebDNA's grep implementation is not POSIX standard, and is a hybrid of sorts, it appeared to work in my quick test that I did before I originally posted... parsing more than one line. A further test showed that it does not work consistently. A yet further test showed that it does not appear to be "capacity limit" thing. Frankly, my real answer is neither "solution". I don't think regular expressions (in WebDNA's grep, or POSIX regex) is the "sure-fire" answer to this problem. However, one could probably build a more thorough regex call (I'd probably call the POSIX regex with [shell] via sed (find/replace) rather than use WebDNA's hybrid grep which is not yet well documented) that would be more versatile and robust, but I think the real answer probably lies in a tried and tested module/function somewhere..probably callable from WebDNA's [SHELL] or what-have-you. Though WebDNA could indeed be the solution for such a problem, *existing* modules are usually the result of many years of work by more than one person, which makes it worth checking out the third party solution. For a solution in WebDNA, I guess I'd start building a parser.. perhaps using listwords and other tools. However, it could be a long rode to get something solid. Since it is not easily done, WSC may look into this to see if something could be done with removehtml... [removehtml comments] or something. This may be worth the effort because it is something that comes up in our line of work occasionally. However, it would fall back on the priority list quite a ways. Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE Pres., EUCA Design Center WEB:> http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] remove html comments (Donovan Brooke 2009)
  2. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  3. Re: [WebDNA] remove html comments (Donovan Brooke 2009)
  4. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  5. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  6. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  7. Re: [WebDNA] remove html comments (Donovan Brooke 2009)
  8. Re: [WebDNA] remove html comments ("Dan Strong" 2009)
  9. Re: [WebDNA] remove html comments ("Dan Strong" 2009)
  10. Re: [WebDNA] remove html comments (Govinda 2009)
  11. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  12. Re: [WebDNA] remove html comments (Toby Cox 2009)
  13. Re: [WebDNA] remove html comments (Owkaye Go 2009)
  14. Re: [WebDNA] remove html comments (Donovan Brooke 2009)
  15. Re: [WebDNA] remove html comments (Bob Minor 2009)
  16. [WebDNA] remove html comments (Owkaye Go 2009)
Owkaye Go wrote: >> (just under 800 lines) and used: >> and it successfully parsed out all the > > I think you say is correct and original answer > wrong. I will test and report my results. Can you > explain why .* is fail but [^-]* success? I didn't say it was correct, I said it will work most of the time. In the "second answer", we are looking for a string match that starts with and does not have "-" in between it. So it will fail, for example, with nested comments, or comments that contain a dash for some reason, or perhaps other formats. However, it is probable that it will work for most people, most of the time. If you are one that uses "-" as a convention in comments, you will have to change the code. Regarding why .* fails, I don't know exactly. traditionally the "." character doesn't work past lines and the "*" character is "greedy" (you'll have to look that up, because this is not a regular expression forum). So, the .* should not work at all for this purpose. However, since WebDNA's grep implementation is not POSIX standard, and is a hybrid of sorts, it appeared to work in my quick test that I did before I originally posted... parsing more than one line. A further test showed that it does not work consistently. A yet further test showed that it does not appear to be "capacity limit" thing. Frankly, my real answer is neither "solution". I don't think regular expressions (in WebDNA's grep, or POSIX regex) is the "sure-fire" answer to this problem. However, one could probably build a more thorough regex call (I'd probably call the POSIX regex with [shell] via sed (find/replace) rather than use WebDNA's hybrid grep which is not yet well documented) that would be more versatile and robust, but I think the real answer probably lies in a tried and tested module/function somewhere..probably callable from WebDNA's [shell] or what-have-you. Though WebDNA could indeed be the solution for such a problem, *existing* modules are usually the result of many years of work by more than one person, which makes it worth checking out the third party solution. For a solution in WebDNA, I guess I'd start building a parser.. perhaps using listwords and other tools. However, it could be a long rode to get something solid. Since it is not easily done, WSC may look into this to see if something could be done with removehtml... [removehtml comments] or something. This may be worth the effort because it is something that comes up in our line of work occasionally. However, it would fall back on the priority list quite a ways. Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE Pres., EUCA Design Center WEB:> http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o Donovan Brooke

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:

WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997) Multiple postings (2000) How far do [showif]s go? (1997) Logging purchases (1997) WebDNA won't start on reboot (2003) breaking & sorting (2000) WebCatalog Hosting (1996) [WebDNA] Foreign characters (2009) (2009) Need relative path explanation (1997) Help with searching dates from mysql dump & searching (2006) [WebDNA] =?UTF-8?B?UmU6IFtXZWJETkFdIFJlOiBbV2ViRE5BXSBSZTogW1dlYkROQV0gUmU6IFtXZWJETkFdIA==?= (2011) [WebDNA] [append] does not add the newline char at the end of the new record?! (which causes subsequent [search] to fail.) (2009) HELP!? (2002) Nested tags count question (1997) Problems with [Applescript] (1997) 2nd WebCatalog2 Feature Request (1996) Questions! (2000) How To (2003) webcatalog approaching max (1998) Wanted: More Math Functions (or, Can You Solve This?) (1997)