Find substring using starting and ending word in a string and substrings indexes in javascript - Javascript String

Javascript examples for String:substring

Description

Find substring using starting and ending word in a string and substrings indexes in javascript

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() {//  www .ja v a  2  s  .  co  m
function extractText(strToParse, strStart, strFinish){
  return strToParse.match(strStart + "(.*?)" + strFinish)[1];
}
console.log(extractText("first second third", "first", "third"));
    });

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

Related Tutorials