Regex to strip span inside a tag using classic ASP -
i strip <span>
tags , styles within <h2>
tags eg
<h2><span style="font-family: sans-serif;">{text remain}</span></h2>
or
<h2><span style="font-family:font-size: 26.3158px;">{text remain}</span></h2>
would become
<h2>{text remain}</h2>
any suggestions of how achieve regex? ideally in classic asp (don't ask).
thanks in advance
i whipped out pretty quick, may have issues, worked. need update double quotes.
<% text = "<h2><span style='font-family:font-size: 26.3158px;'>{text remain}</span></h2>" dim objregexp : set objregexp = new regexp objregexp.pattern = "<\/?span(\ style='.*')?>" objregexp.ignorecase = true objregexp.global = true cleantext = objregexp.replace(text, "") response.write text response.write cleantext %>
results:
<h2><span style='font-family:font-size: 26.3158px;'>{text remain}</span></h2> <h2>{text remain}</h2>
Comments
Post a Comment