def sub_html_tag(sub, html): fsa = FSA(HTML_TAG_STATES, start="start", end="end") result, start, end = fsa.search(html) while result: html = html[:start] + str(sub) + html[end:] result, start, end = fsa.search(html, start) return html
} </style> </head> <body> <p> para 1 hereeeeeeeeeeeeeeeeeee </p> <script type="text/javascript"> if ( 1 < 2 && 2 > 5 ) { alert('hello world'); } </script> <p onload="if(32>1024) callfoo(); else do anit"> para 2 whaaaaaaaaat </p> <script> <!-- if (isIE) {gogogogogoogo booooooom} --> </script> <p> paragraph 333333333 </p> </body> </html> """ fsa = FSA(HTML_TAG_STATES, start="start", end="end") result, start, end = fsa.search(html) while result: html = html[:start] + html[end:] result, start, end = fsa.search(html) print html