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

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -