I have HTML string with the JavaScript and CSS code blocks:
<script type="text/javascript">
alert('hello world');
</script>
<style type="text/css">
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color: red;}
</style>
How to strip those blocks?
Any suggestion about the regular expressions that can be used to remove those?
The quick ‘n’ dirty method would be a regex like this:
The better* (but possibly slower) option would be to use HtmlAgilityPack:
*) For a discussion about why it’s better, see this thread.