Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js regex between two words

const text = 'My cow always gives milk'
const start = `cow`;
const end = `milk`;
const middleText = text.split(start)[1].split(end)[0]
console.log(middleText) // prints "always gives"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #regex #words
ADD COMMENT
Topic
Name
5+7 =