How to find substring between the two words using jQuery
match() method to extract substring between two words.
The following example will show you how to extract substring between the two words using the
match() method and a simple regular expression pattern.
ExampleTry this code »
<title>jQuery Get Substring Between Two Words</title>
var myStr = "The quick brown fox jumps over the lazy dog.";
var subStr = myStr.match("quick(.*)lazy");
<p>Click the following button to get the substring between the word "quick" and "lazy" from the string "The quick brown fox jumps over the lazy dog."</p>
<button type="button">Get Substring</button>
Here are some more FAQ related to this topic: