Find the index of a word in the whole sentence - Javascript String

Javascript examples for String:indexOf

Description

Find the index of a word in the whole sentence

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() {/*from   w  w  w . j av a 2  s. c om*/
var str = 'something footer=bob and something=earl';
str = str.replace(/footer=(.*?)\s/g, 'footer=whatever');
document.body.innerHTML = str;
    });

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

Related Tutorials