Is there a method to determine if a multi-line string contains HTML tags(<>) within it?
var regex= /^(?!.*<[^>]+>).*$/;
console.log('istextWithoutHtml--', regex.test('Line1\nLine2'));\\ Expecting true, since it doesnt have html tags
\\ Expecting false for these combinations, since it contains html tags in it
\\ 'Line1<a>\nLine2'
\\ 'Line1\nLine2<p>'
\\ '<a></a>'
\\ '<\img>'
\\ '</a>\n</b>'
Trial 1
var regex1 = new RegExp(regex);
console.log('istextWithoutHtml---', regex1.test('Line1\nLine2')); \\ false (I am expecting true here)
console.log('istextWithoutHtml---', regex1.test('Line1<a>\nLine2')); \\ false
Trial 2
var regex2 = new RegExp(regex, 's');
console.log('istextWithoutHtml---', regex2.test('Line1\nLine2')); \\ true
console.log('istextWithoutHtml---', regex2.test('Line1<a>\nLine2')); \\ true (I am expecting false here)
Trial 3
var regex3 = new RegExp(regex, 'm');
console.log('istextWithoutHtml---', regex3.test('Line1\nLine2')); \\ true
console.log('istextWithoutHtml---', regex3.test('Line1<a>\nLine2')); \\ true (I am expecting false here)
Is there any way to achieve both HTML tag check in the multiple line string.