I build a regular expression to locate a piece of text:
var re = /Incident:(.*)\tDescriptio/gm;
var m;
while ((m = re.exec(resultados_texto)) !== null) {
if (m.index === re.lastIndex) {
re.lastIndex++;
}
}
where resultados_texto
is a variable of type string
to which I have given the content of a text file.
I want to get the content of group 1, that is, everything contained in (.*)
The problem is that I think the syntax is well built, but it returns me that m
is null
What is the flaw in the syntax?