Javascript examples for RegExp:Match HTML
Select single word between any HTML tag using regex
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <div id="main"> <p class="yourword"> askdaksjdb </p> </div> <script> var str = document.getElementById("main").innerHTML; var res = str.match(/yourword/gi); console.log(res); </script> </body>/* w w w. j a v a 2 s. com*/ </html>