$nohtml
Posted by CrashB
Monday, April 12, 2004
Description: my version :)

Example:

$nohtml(<html>stuff</html>) returns "stuff"

alias nohtml {
  var %i 1
  var %b 0
  while %i <= $len($1-) {
    if $asc($mid($1-,[ %i ],1)) == 60 { var %b 1 }
    if $asc($mid($1-,[ %i ],1)) == 62 { var %b 2 }
    if %b == 0 { var %nohtml %nohtml $+ $replace($mid($1-,[ %i ],1),$chr(32),$chr(160)) }
    if %b == 2 {
      var %nohtml %nohtml $+ $chr(160)
      var %b 0
    }
    inc %i
  }
  return $replace([ %nohtml ],$chr(160),$chr(32))
}
$nohtml
Posted by Parasite-FT-
Friday, April 16, 2004 09:49pm PDT
A mix of the old $nohtml with regex, and the $htmlfree which can be found on ms.org

Cheers,
- Para


alias nohtml {
  var %parsed, %regex = $regsub($1-,m~([^<]*>|<[^>]+>|<[^>]*)|(&nbsp;)~g,$chr(32),%parsed)
  return %parsed
}
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world