Match Regexp with start&end tokens

Match Regexp with start&end tokens

by MoscaPt

HTML

<div id='test'>Hello World!</div>

JavaScript

var test = "<html>...<p>STARTgimme the guts!END</p></html>";

var testRE = test.match("START(.*)END"); 

// Syntax for match return type as array:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match
testRE.forEach(function(element) {
    alert(element)
});