RegExp from string: replace "greater than" sign - Javascript jQuery

Javascript examples for jQuery:String

Description

RegExp from string: replace "greater than" sign

Demo Code

ResultView the demo in separate window

<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 &gt;:) how it looks?</pre>  
 </body>
</html>

Related Tutorials