I try to extract text between parapgraph tag using RegExp in javascript. But it doen't work...
My pattern:
<p>(.*?)</p>
Subject:
<p> My content. </p> <img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTJ9ylGJ4SDyl49VGh9Q9an2vruuMip-VIIEG38DgGM3GvxEi_H"> <p> Second sentence. </p>
Result :
My content
What I want:
My content. Second sentence.
<p>tags just fine with regex (despite the warnings against parsing generally with it), but if you're using JavaScript there's no need to since you havedocument.getElementsByTagName("p").document.getElementsByTagName()is a DOM method. It is only available to JavaScript because the browser provides it. With node.js, there is no browser, and node.js does not natively parse HTML into a DOM. You can't assume that, just because you are using the JavaScript language, a browser DOM is available. A DOM can be made available to node.js if such a package is installed, such as jsdom.