I have this string:
var str = "Toto PARKER rejected the task.<br><br>Approval comments:<br>11-07-2017 20:11:29 - James EY (Comments)<br>NO!!<br><br>";
I would like a function to return "NO!!"
To do this i using:
<p>Click the button to display the array values after the split.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var str = "Toto PARKER rejected the task.<br><br>Approval comments:<br>11-07-2017 20:11:29 - James EY (Comments)<br>NO!!<br><br>";
var res = str.match("(<br\s*[\/]?>)[1](.*)(<br\s*[\/]?><br\s*[\/]?>)");
document.getElementById("demo").innerHTML = res[0];
}
</script>
I have some difficulties with my regex because the return is:
<br>11-07-2017 20:11:29 - James EY (Comments)<br>NO!!<br><br>
So, how to start my regex with the last <br> (to return <br>NO!!<br><br>) and after how to not return <br>?
brtags, so you can use/<br>(.*?)<br>/g