JSFiddle - React, Tailwind, and code Playground
HTML
<p id="output">The match was found on line </p>
JavaScript
var string = "This\nstring\nhas\nmultiple\nlines.";
astring = string.split('\n');
console.log(astring);
match = /has/;
Array.each(astring, function(line, number) {
if (match.exec(line))
$('output').innerHTML += number + 1;
});