The below script results in : res = NEW I would like the result to be: res = NEW_okok_NEW
The .+ finds the first START and the last END, but I want it to find the next START and the next/following END, and replace it. How is that possible ?
<script>
$ (function () {
var str = "START_sometext_END_okok_START_someothertext_END";
var res = str.replace(/(START.+END)/g,'NEW');
alert(res);
});
</script>