Use regex replace functions to create ID - Javascript RegExp

Javascript examples for RegExp:RegExp test

Description

Use regex replace functions to create ID

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-2.1.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from  w w w.  j  a  v  a2s  .  c o  m*/
var storeName = "St. Bob's Store";
var storeId = storeName.replace(/\./g,"").replace(/\s/g, '').replace(/'/g,"");
console.log(storeId);
    });

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

Related Tutorials