// 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"(?s)(?<URL>\/upload(.+?)pdf).+?(?P<DATE>\d{2}\.\d{2}\.\d{4})").unwrap();
let string = "<div class=\"rasschetSredstv\">
<table class=\"tab td_tac\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">
<tbody><tr>
<th width=\"17%\">Январь</th>
<th width=\"17%\">Февраль</th>
<th width=\"17%\">Март</th>
<th width=\"17%\">Апрель</th>
<th width=\"17%\">Май</th>
<th width=\"17%\">Июнь</th>
</tr>
<tr>
<td>
<a target=\"_blanc\" href=\"/upload/iblock/2da/otchet_ss_310117.pdf\">Скачать</a><br>
pdf(201 кБ)<br> (14.02.2017 12:44:00) </td>
<td>
<a target=\"_blanc\" href=\"/upload/iblock/aa8/otchet_rss_na_sayt.pdf\">Скачать</a><br>
pdf(196 кБ)<br> (15.03.2017 18:49:00) </td>
<td>
<a target=\"_blanc\" href=\"/upload/iblock/71e/raschet_ss_na_sayt.pdf\">Скачать</a><br>
pdf(197 кБ)<br> (14.04.2017 18:23:00) </td>
<td>
----
</td>
<td>
----
</td>
<td>
----
</td>
</tr>
<tr>
<th>Июль</th>
<th>Август</th>
<th>Сентябрь</th>
<th>Октябрь</th>
<th>Ноябрь</th>
<th>Декабрь</th>
</tr>
<tr>
<td>
----
</td>
<td>
----
</td>
<td>
----
</td>
<td>
----
</td>
<td>
----
</td>
<td>
----
</td>
</tr>
</tbody></table>
</div>";
// 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/