javascript – Extraction of text from simple html snippets using regex

<h1 itemprop="name" class="fs-headline1"><a href="/nextpage" class="question-hyperlink">How do you answer this?</a></h1>

I need to extract text from simple html snippets like these using regular expressions.
The tags of the html snippets can vary.

I have tried /<.*?>/g and could get all the html opening and closing tags, but unable to subtract this selection from the original html snippet to get the text.

Can anyone help.
Thanks in advance.

Product of the Month September 2016

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *