javascript - jquery regexp - HTML tag from string -
how can separate html table tag string using regular expression?
var stabstring =' ... <table > <table ... string ... id="unique_1" ... string ...> abc def <table > ... '; var sreg = '< *table .* id *= *"unique_1" .*>'; var sregex = new regexp(sreg); var sresult = stabstring .match(sregex); alert(sresult);
i expect open tag attributes follows:
<table ... string ... id="unique_1" ... string ...>
this every <table>
element (and attributes) in string.
var regex = new regexp("<table.*?>", "g"); var result = str.match(regex); (var i=0; i<result.length; i++) { // <table> elements here console.log(result[i]); }
Comments
Post a Comment