Find Characters and wrap with HTML - Javascript String Operation

Javascript examples for String Operation:String Character

Description

Find Characters and wrap with HTML

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {// w  w w  .j  a v a  2 s  .  c om
var mystring = "abc//def////ghi///jkl/mno";
mystring = mystring.replace(/((?:\/{2})+)/g, "<span class=\"slashes\">$1</span>");
console.log(mystring);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials