Re: [PHP] detecting HTML tags
bill <[EMAIL PROTECTED]> wrote: > > Is there a way to detect the presence of HTML tags? > > I don't want them stripped out, I just want to know if a string contains > them. > > I'm rolling my own mailing program and want it to detect the HTML if > present and send it appropriately. > > kind regards, > > bill hollett > Regex is the way to go, but as an aside - the mere presence of html tags in a mail message body does not make it an HTML message. It is perfectly reasonable to send a message containing something like this: "That HTML tag you're looking for is " and expect it to NOT be rendered as HTML on the other end but displayed exactly as you typed it. Likewise it's legitimate to send a "text/html" message that contains no HTML elements at all. When sending HTML mail a program should only set the content-type to "text/html" if the sender explicitly requests it, not when it detects HTML elements in the body. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] detecting HTML tags
On Tuesday 15 May 2001 18:25, Jack Dempsey wrote: > $text = " 50 < 100 + 240"; > not html... > > would want regex's i would think, or the striptags version someone > sent before... Well, then preg_match ('/<[a-z]/i', $text) should work. > > > Is there a way to detect the presence of HTML tags? > > > I'm rolling my own mailing program and want it to detect the HTML > > > if present and send it appropriately. > > > > if (strstr ($text, '<')) { > > UseHTML ($text); > > } else { > > UsePlaintext ($text); > > } -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka", but "That's funny..." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] detecting HTML tags
Yes, I thought similarly. But so far, neither works. $string="blah x<4 blah"; if (strlen($string) != strlen(strip_tags($string))){ echo "html"; } else { echo "text"; } The above still echos "html". kind regards, bill Jack Dempsey wrote: > $text = " 50 < 100 + 240"; > not html... > > would want regex's i would think, or the striptags version someone sent > before... > > -jack > > Christian Reiniger wrote: > > > > On Tuesday 15 May 2001 16:39, bill wrote: > > > Is there a way to detect the presence of HTML tags? > > > > > > I don't want them stripped out, I just want to know if a string > > > contains them. > > > > > > I'm rolling my own mailing program and want it to detect the HTML if > > > present and send it appropriately. > > > > if (strstr ($text, '<')) { > > UseHTML ($text); > > } else { > > UsePlaintext ($text); > > } > > > > -- > > Christian Reiniger > > LGDC Webmaster (http://sunsite.dk/lgdc/) > > > > The most exciting phrase to hear in science, the one that heralds new > > discoveries, is not "Eureka", but "That's funny..." > > > > - Isaac Asimov > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] detecting HTML tags
Hi Bill ]{1,})*([\>])/i", $string)) { echo "Houston, we have a problem."; } ?> James. "bill" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a way to detect the presence of HTML tags? > > I don't want them stripped out, I just want to know if a string contains > them. > > I'm rolling my own mailing program and want it to detect the HTML if > present and send it appropriately. > > kind regards, > > bill hollett > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] detecting HTML tags
$text = " 50 < 100 + 240"; not html... would want regex's i would think, or the striptags version someone sent before... -jack Christian Reiniger wrote: > > On Tuesday 15 May 2001 16:39, bill wrote: > > Is there a way to detect the presence of HTML tags? > > > > I don't want them stripped out, I just want to know if a string > > contains them. > > > > I'm rolling my own mailing program and want it to detect the HTML if > > present and send it appropriately. > > if (strstr ($text, '<')) { > UseHTML ($text); > } else { > UsePlaintext ($text); > } > > -- > Christian Reiniger > LGDC Webmaster (http://sunsite.dk/lgdc/) > > The most exciting phrase to hear in science, the one that heralds new > discoveries, is not "Eureka", but "That's funny..." > > - Isaac Asimov > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] detecting HTML tags
On Tuesday 15 May 2001 16:39, bill wrote: > Is there a way to detect the presence of HTML tags? > > I don't want them stripped out, I just want to know if a string > contains them. > > I'm rolling my own mailing program and want it to detect the HTML if > present and send it appropriately. if (strstr ($text, '<')) { UseHTML ($text); } else { UsePlaintext ($text); } -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka", but "That's funny..." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] detecting HTML tags
You could try something like if (strlen($string) != strlen(strip_tags($string)) { // maybe some html in string } -Stewart -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: 15 May 2001 15:40 To: [EMAIL PROTECTED] Subject: [PHP] detecting HTML tags Is there a way to detect the presence of HTML tags? I don't want them stripped out, I just want to know if a string contains them. I'm rolling my own mailing program and want it to detect the HTML if present and send it appropriately. kind regards, bill hollett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] detecting HTML tags
Look into regular expressions. -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 10:40 AM To: [EMAIL PROTECTED] Subject: [PHP] detecting HTML tags Is there a way to detect the presence of HTML tags? I don't want them stripped out, I just want to know if a string contains them. I'm rolling my own mailing program and want it to detect the HTML if present and send it appropriately. kind regards, bill hollett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] detecting HTML tags
Is there a way to detect the presence of HTML tags? I don't want them stripped out, I just want to know if a string contains them. I'm rolling my own mailing program and want it to detect the HTML if present and send it appropriately. kind regards, bill hollett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]