Javascript examples for String Operation:String Replace
Use Regular expression to replace middle of multiline string
<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 2 s . c o m document.body.innerHTML = document.body.innerHTML.replace(/"[\s\S]*?<a>\w+: (.+)<\/a>[\s\S]*?"/g, '$1'); } </script> </head> <body> " <a>Customer: John Doe</a> " <br> <br> <br> " <a>Customer: John</a> " </body> </html>