Need a regular expression to match a string contains table tag <TABLE
and ends with >
in between it may have any character other than alert
word.
For example: With regular expression for following String(html code) 2nd line shouldn't match if it have alert
word otherwise it should match 2nd line
1. <DIV type="HEADER">
2. <TABLE border="0" cellpadding="7" cellspacing="0" width="655" onmouseover="alert('Table XSS')">
3. <COL width="313" />
4. <TBODY>
5. <TR valign="TOP">
6. <TD width="313">
7. <P align="LEFT" style="margin-top: 0in">
8. <IMG border="0" height="33" name="graphics3" src="/abc" width="74" />
9. </P>
10. </TD>
11. </TR>
12. </TBODY>
13. </TABLE>
14. </DIV>
I tried with this <table(?!alert)[\s\S]*[^>]*>
regular expression but it's selecting 2nd line in above mentioned code.
Please help me to get appropriate regular expression to my requirement and thanks in advance.