Javascript examples for RegExp:Match HTML
Use Regex only on non-html code
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from w w w . j a v a 2s. co m var str = '<strong class="foo">Lorem ipsum strong dolorem</strong>'; var re = /strong(?!(>|\s\w+=))/g; console.log(str.replace(re, 'REPLACED')) }); </script> </head> <body> </body> </html>