Using Regex to remove script tags
Posted
by amitre
on Stack Overflow
See other posts from Stack Overflow
or by amitre
Published on 2010-03-24T07:23:55Z
Indexed on
2010/03/24
7:33 UTC
Read the original article
Hit count: 463
Hi, I'm trying to use a Regex expression I've found in this website and it doesn't seem to work. Any ideas?
Input string:
sFetch = "123<script type=\"text/javascript\">\n\t\tfunction utmx_section(){}function utmx(){}\n\t\t(function()})();\n\t</script>456";
Regex:
sFetch = Regex.Replace(sFetch, "<script.*?>.*?</script>", "", RegexOptions.IgnoreCase);
Thanks!!!
© Stack Overflow or respective owner