Javascript examples for String:replace
Remove all whitespaces except when space is part of an exact string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w . ja v a2 s . co m*/ var string = "<h1 class='' id='' title=''></h1>"; var regexp = /(\w+='')\ /g; var string = string.replace(regexp, "$1"); console.log(string); } </script> </head> <body> </body> </html>