// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r#"(?is)^(?:[[:^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]+$"#).unwrap();
let string = "<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>";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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 Rust, please visit: https://docs.rs/regex/latest/regex/