Something
public text v1 · immutableproc 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>