Regular expression to match any table tag
Posted
by
keeg
on Stack Overflow
See other posts from Stack Overflow
or by keeg
Published on 2013-11-04T21:51:28Z
Indexed on
2013/11/04
21:52 UTC
Read the original article
Hit count: 260
regex
I'm trying to write a regular expression to see if a string contains any of the typical table tags:
<table></table>
<td></td>
<th></th>
<tr></tr>
<thead></thead>
<tfoot></tfoot>
<tbody></tbody>
Along with tags that may contain other attributes e.g:
<table border="1">
I've come up with this so far, however, it matches <br />
tag and I'm not sure why:
/<\/?[table|td|th|tr|tfoot|thead|tbody]{1,}>?/
© Stack Overflow or respective owner