const regex = /<li.*?(?!<br).*?\/li>/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('<li.*?(?!<br).*?\\\/li>', 'gm')
const str = `Linda Casa Térrea com edícula em São Paulo - Vila Alpina<br /><br /> Casa principal é térrea. Sala de estar, sala de jantar cozinha ampla, 03 dormitórios sendo 01 suíte com closet, 05 vagas cobertas. <br /> Casa principal é térrea. Sala de estar, sala de jantar e cozinha ampla. <li>Teste 1</li><li>Teste 2</li><li>Teste 3</li><br /> Casa dos fundos é um loft moderno com pé direito duplo, mezanino, sala 02 ambientes com lareira, cozinha americana planejada, 01 suíte com armários planejados e hidromassagem, jardim de inverno com espelho d'água. <br /><br /> Jardim com 80 m², espaço gourmet com 02 quiosques. <br /><br /><b> Área construída 300 m² / Área total 380 m²:</b><li>Teste 1</li><li>Teste 2</li><li>Teste 3</li><br /><br /> Valor R\$ 800.000,00<br /> <span class="censor">Ref. 3128</span><br /><br /> <br /> <a class="censor link txtLnk ex" href="link=Z2FicmllbGltb3ZlaXMuY29tLmJy" title="Clique para abrir este link" rel="nofollow">teste.com.br</a><br /> <a class="censor link txtLnk nb" href="mailto:teste@teste.com.br" title="Clique para enviar um email a este destinatário" rel="nofollow">teste@teste.com.br</a>`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions