All pastes #25951 Raw Edit

Something

public text v1 · immutable
#25951 ·published 2005-10-19 12:46 UTC
rendered paste body
proc strip-html-ignore {text {ignore {}}} {
    set c 0
    foreach i $ignore {if {[regexp ".*$i.*" $text]} {return $text}}
    return ""
}

proc strip-html {html {ignore {}}} {
    regsub -all -- {<[^>]*>} $html "\[strip-html-ignore \"&\" [list $ignore]\]" html
    set html [subst $html]
    return $html
}


Syntax: strip-html text [list ignore1 ignore2]

Example:

set a {<pre><a href=bla>roi<hr></a></pre><br>}
puts [strip-html $a [list <br> <a.*>]]

will output:
<a href=bla>roi<br>