i have a variable "html" with an HTML code.
I need to extract:
<h4 class="search-results-count">ANY TEXT THAT GOES HERE</h4>
but i can't figure how to do that with regex or another tecnique
i have a variable "html" with an HTML code.
I need to extract:
<h4 class="search-results-count">ANY TEXT THAT GOES HERE</h4>
but i can't figure how to do that with regex or another tecnique
You can extract the innerHTML like
document.querySelector('.search-results-count').innerHTML
You should not parse html with regex
You can use the following regex: (not recommended)
<h4[^>]*>([^<]*)<\/h4>
And extract group 1.. $1
See demo