HTML detection

jbv jbv.silences at
Thu Oct 12 05:16:54 EDT 2006


> JBV, I think I would need more information about what you're trying to
> do. If you're talking about strict HTML, then of course as previously
> mentioned, checking for "<html" in the string should work. If you're
> looking to strip tags from text then there are a couple ways to do
> that.

what I want to do is pretty simple : I have a variable with some raw
text, and I want to know if that text contains html tags or not...
I can't use fields since it's part of a cgi script...

and finally, an idea crossed my mind : why not do the opposite of
stripping tags from text ? if I strip all text that isn't within "<" and ">"
and test if my variable is empty or not, then I can decide if it contains
tags... I guess a Regex can do that...

or even simpler : after stripping tags from text , comparing the number
of chars left in my variable with its original content will tell me if it
contains tags or not...

Thank you all for helping me find a solution by myself...    ;-)


More information about the use-livecode mailing list