// 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#"(<p class="headline light")[\s\S]*<\/p>"#).unwrap();
let string = "</table>
</div>
<div>
<table class=\"row\" style=\"border-spacing:0;border-collapse:collapse;text-align:left;vertical-align:top;padding:0;width:100%;position:relative;display:table\">
<tr class=\"\" style=\"padding:0;vertical-align:top;text-align:left\">
<th class=\"small-12 large-12 columns first last\" style=\"font-size:16px;padding:0;text-align:left;color:#0a0a0a;font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;line-height:1.3;margin:0 auto;padding-bottom:16px;width:564px;padding-left:16px;padding-right:16px\">
<a href=\"https://www.airbnb.com/rooms/show?euid=c4130567-c3af-eb6e-605b-76a13688cf5d&id=12670046\" style=\"font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;margin:0;text-align:left;line-height:1.3;color:#2199e8;text-decoration:none\">
<img src=\"https://a0.muscache.com/im/pictures/2633deb9-ebbd-4dcb-b0f5-44d840636280.jpg?aki_policy=large\" class=\"row-pad-bot-1\" style=\"display:block;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic;width:auto;clear:both;max-width:100%;border:none;padding-bottom:8px !important\">
</a>
</th>
</tr>
</table>
<table class=\"row destination-card\" style=\"border-spacing:0;border-collapse:collapse;text-align:left;vertical-align:top;padding:0;width:100%;position:relative;display:table\">
<tr style=\"padding:0;vertical-align:top;text-align:left\">
<th class=\"small-12 large-12 columns first destination-card-text row-pad-bot-3\" style=\"font-size:16px;line-height:1.3;color:#0a0a0a;font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;text-align:left;padding-right:8px;margin:0 auto;padding-bottom:16px;width:564px;padding-left:16px\">
<a href=\"https://www.airbnb.com/rooms/show?euid=c4130567-c3af-eb6e-605b-76a13688cf5d&id=12670046\" style=\"font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;margin:0;text-align:left;line-height:1.3;color:#2199e8;text-decoration:none\">
<p class=\"headline light\" style='padding:0;margin:0;text-align:left;font-weight:300;-ms-hyphens:none;word-break:keep-all;hyphens:none;-webkit-hyphens:none;-moz-hyphens:none;color:#484848;font-family:\"Circular\", \"Helvetica\", Helvetica, Arial, sans-serif;font-size:24px;line-height:1.3;margin-bottom:0 !important'>
The Shala - Sunset Room ›
</p>
<p class=\"subheadline light\" style='padding:0;margin:0;text-align:left;margin-bottom:10px;font-weight:300;font-family:\"Circular\", \"Helvetica\", Helvetica, Arial, sans-serif;color:#484848;font-size:18px;line-height:1.4;padding-top:4px'>
Private room
</p>
</a>
</th>
</tr>
</table>
</div>
<div>
";
// result will be a tuple containing the start and end indices for the first match in the string
let result = regex.captures(string);
let (start, end) = match result {
Some((s, e)) => (s, e),
None => {
// ...
}
};
println!("{}", &string[start, end]);
}
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/