get string between two strings with javascript [duplicate]
问题 This question already has answers here : Javascript Regex: How to put a variable inside a regular expression? [duplicate] (9 answers) Closed 6 years ago . How do I get a string between two strings using match with variables? The following code works well if I use match with strings Regular Expression to get a string between two strings in Javascript I also tried to apply the info at JavaScript - Use variable in string match : var test = "My cow always gives milk"; var testRE = test.match("cow