remove html tags from text

Richard Gaskin ambassador at fourthworld.com
Sun Sep 10 13:55:18 EDT 2006


Mark Smith wrote:
> On 10 Sep 2006, at 16:26, Richard Gaskin wrote:
> 
>> So until someone can demonstrate otherwise, I'm sticking with using  
>> fields to strip tags from text.....
> 
> Though doesn't this approach fail with legitimate "<" characters in  
> <code>  (or other) tags?
> 
> Of course, that may not be important in your usage.

It's very important for most of us, since we're looking for the most 
robust solution.

I just tried it and found that this:

<pre>
put 2<3
</pre>

...produces an incomplete rendering like this:

   put 2

...but this:

<pre>
put 2< 3
</pre>

...is rendered as expected like this:

put 2< 3


I would imagine similar results if we special-case the regex solution to 
also handle non-white space after a "<".

If both methods are equally robust then the one to use would be the 
fastest.  But if one of more fault-tolerant than the other, than if the 
speed of both is at least acceptable than I'd go with the more robust one.

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list