I read a file with javascript and this file contains a lot of begin and end statement like below , and my purpose is to remove every thing that exists between these begin and en
To hold text inside the tags:
var res = string.match(/([\s\S]*?)<\/END>/g);
To remove text inside the tags:
var res = string.replace(/([\s\S]*?)[\s\S]*?<\/END>/g, '$1');
To remove text outside the tags:
var res = string.replace(/[\s\S]*?<\/END>/g, '');