Javascript examples for jQuery:String
RegExp from string: replace "greater than" sign
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-compat-git.js"></script> <script type="text/javascript"> $(window).on('load', function() { var msg = $("pre").text(); var s = ">:\\)"; var reg = new RegExp(s, "g"); $("pre").text( msg.replace(reg, "IT WORKS!!") ) });//w w w . j a va2 s.co m </script> </head> <body> <pre>this is angry smile >:) how it looks?</pre> </body> </html>