rendered paste bodyalias dehtml {
var %commonchars = lt|gt|amp|quot|apos
var %commoncharcodes = 60|62|38|34|39
var %i = $regex($1, /(&(?:#\d+| $+ %commonchars $+ );)/gi), %chr, %after, %retval
if (!%i) { return $1 }
set -n %retval $1
while (%i) {
%chr = $mid($regml(%i), 2, -1)
; some very common escapes
if ($findtok(%commonchars, %chr, 1, 124)) { %chr = $gettok(%commoncharcodes, $ifmatch, 124) }
; since mIRC doesn't support unicode characters, turn them into question marks
else {
%chr = $mid(%chr, 2)
if (%chr > 255) { %chr = 63 }
}
set -n %after $mid(%retval, $calc($regml(%i).pos + $len($regml(%i))))
set -n %retval $+($left(%retval, $calc($regml(%i).pos - 1)), $chr(%chr), %after)
dec %i
}
return %retval
}
alias htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return $dehtml(%x)
}