Say my string is this:
var testexample = <p nameIt="Title">Title_Test</p><figure class="t15"><table><thead><tr>
<th><span>Column1</span></th><th><span>Column2</span></th></tr></thead><tbody><tr><td><span>Entry1</span></td><td><span>Entry2</span></td><td><span>ready</span></td></tr></tbody></table></figure><p ex="ready">!aaa;
It's quite a long string, but it's a table written out in string form. How would I get the words from in between <span>
and </span>
? For example, I would like it to return Column1, Column2, Entry1, Entry2 (maybe in an array?)
Here is what I tried so far:
storing = testexample.match(/<span>(.*)</span>/);
But it only returned "Column1" I also tried doing matchAll, exec, and doing /<span>(.*)</span>/g
. These results gave me the whole string, nothing, things like <th><span>Column1</span></th>
, or the just "Column1" again.
I'm quite new at javascript so I'm unsure what I'm doing wrong as I have read the documentation for this. Any help would be appreciated. Thank you.