remove html tags from text

Ken Ray kray at sonsothunder.com
Sun Sep 10 03:41:03 EDT 2006


On 9/10/06 12:06 AM, "Richard Gaskin" <ambassador at fourthworld.com> wrote:

> So I have two questions about this sort of parsing as opposed to using a
> field object to so the same:
> 
> 1. Which is more fault-tolerant?

Good question - one problem with the field object that was identified by
Sivakatirswami back in August with this was that if you have an html tag
with <title> in it (like: <title>Chapter 1: Great Revolution
Recipes</title>), when you set the htmlText of the field to the html that
contains the <title>, everything that is in the <title> tag doesn't show up
in the field, and can't be retrieved ever again.

Granted, I'm sure there are only a few situations like this, and are not
likely to affect 99% of us, but I think the replaceText solution is at about
the same level of efficiency.
 
> 2. Which is faster?

The field approach, hands down. This is because any regex that needs to run
needs to be handled by the PCRE library so there's more "hand off" time
involved.

Just my 2 cents,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the Use-livecode mailing list