const regex = /^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*(?:<[^>]+>\s*)+<title>contador\s*de \s*acessos<\/title>.{0,1350}?\$caminho\s*=\s*"contador\.txt.{0,150}?\$arquivo\s*=\s*fopen\(\$caminho.{0,150}?numero\s*de\s*visitas\s*fclose\(\$arquivo.{0,650}?<meta.{0,50}?url=['"]contador\.php.{0,50}?\/html[[:punct:]\s]+$/gis;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(?:[[:^print:][:cntrl:]\\s]|GIF89.{0,20})*(?:<[^>]+>\\s*)+<title>contador\\s*de \\s*acessos<\\\/title>.{0,1350}?\\$caminho\\s*=\\s*"contador\\.txt.{0,150}?\\$arquivo\\s*=\\s*fopen\\(\\$caminho.{0,150}?numero\\s*de\\s*visitas\\s*fclose\\(\\$arquivo.{0,650}?<meta.{0,50}?url=[\'"]contador\\.php.{0,50}?\\\/html[[:punct:]\\s]+$', 'gis')
const str = `<html>
<head>
<title>Contador de Acessos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
color: #FF0000;
font-family: Verdana;
font-size: 12px;
}
body {
background-color: #CCCCCC;
}
.style1 {
font-size: 15px;
font-weight: bold;
}
.style2 {
font-size: 12px;
color: #FF0000;
}
.style3 {
font-size: 15px;
color: #000000;
}
.style4 {color: #000000}
.style5 {font-size: 15px; font-weight: bold; color: #000000; }
.style8 {font-size: 24px; font-weight: bold; }
.style9 {color: #CCCCCC}
.style11 {color: #FF0000}
.style12 {color: #FFFFFF}
.style15 {color: #FFFFFF; font-size: 20px; }
-->
</style><body link="#FF0000" vlink="#FF0000" alink="#FF0000">
<center>
<table width="476" border="0">
<tr>
<td width="470" bgcolor="#000000"><div align="center"><span class="style15"> CONTADOR - <span class="style11">BB</span></span> </div></td>
</tr>
</table>
<p><span class="style5"> \$\$ CONTADOR DE ACESSOS \$\$ <br>
<br>
<span class="style2">==========================================================</span><br>
</span><br>
<span class="style4">VOCÊ POSSUI<span class="style9">-</span> </span>
</h1>
<span class="style8">
<?php
\$caminho = "contador.txt";//nome do arquivo que vai guardar os visitantes
\$arquivo = fopen(\$caminho, "r");//abre o arquivo
\$total = fgets(\$arquivo,1024); //pega o numero de visitas
fclose(\$arquivo);//fecha o arquivo
\$x = \$total;
echo "" . \$x;//mostra na tela o numero de visitantes
?>
</span> <span class="style4"> CLIQUES.</span> <br>
<br>
<br>
<br>
<span class="style4"><strong>OBS:</strong> A PÁGINA FICA ATUALIZANDO AUTOMATICAMENTE EM 60 SEGUNDOS. </span></p>
<table width="568" border="0">
<tr>
<td bgcolor="#000000"><div align="center"><span class="style12">CONTADOR SPAM<span class="style11"></span></span></div></td>
</tr>
</table>
<p><br>
</p>
<meta http-equiv='Refresh' content='60'; URL='contador.php'>
</center>
</body>
</head>
</html>`;
// 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