// 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#"(?m)src=\"(\S+)?\".+\s.+\s.+href=(\S+).+ember-view\">\s+(\S+)?(?:\s(\S+))\s(\S+)\s+.+\s+.+\s.+\s\S+\s.+\s.+clamp__line.+?(?=>)\W(\s+.+(?=<!)|.+(?=<\/span>))"#).unwrap();
let string = "<section id=\"ember381\" class=\"artdeco-card artdeco-card--with-hover ember-view\"><!---->
<div class=\"org-people-profile-card__profile-info\">
<artdeco-entity-lockup stacked=\"center\" size=\"5\" id=\"ember382\" class=\"artdeco-entity-lockup--stacked-center artdeco-entity-lockup--size-5 artdeco-entity-lockup ember-view\"><artdeco-entity-lockup-image id=\"ember383\" class=\"artdeco-entity-lockup__image artdeco-entity-lockup__image--type-circle ember-view\" type=\"circle\"><a data-control-name=\"people_profile_card_image_link\" href=\"/in/omar-bakali-85464741/\" id=\"ember384\" class=\"ember-view\"> <img class=\"lazy-image loaded\" alt=\"Omar’s profile picture\" src=\"https://media.licdn.com/dms/image/C4D03AQFLLRD0oaAAPw/profile-displayphoto-shrink_100_100/0?e=1565827200&v=beta&t=1FUl_3ALdjwdoHj0Oqq1lt5Es-0SPekm1zt-G_iVH3g\" width=\"72\" height=\"72\">
</a>
</artdeco-entity-lockup-image><artdeco-entity-lockup-content id=\"ember385\" class=\"artdeco-entity-lockup__content ember-view\"><artdeco-entity-lockup-title id=\"ember386\" class=\"artdeco-entity-lockup__title ember-view\"><a data-control-name=\"people_profile_card_name_link\" href=\"/in/omar-bakali-85464741/\" id=\"ember387\" class=\"link-without-visited-state ember-view\"> <div id=\"ember389\" class=\"org-people-profile-card__profile-title t-black lt-line-clamp lt-line-clamp--single-line ember-view\"> Omar Bakali
<!----></div>
</a>
</artdeco-entity-lockup-title> <artdeco-entity-lockup-badge id=\"ember390\" class=\"artdeco-entity-lockup__badge ember-view\"> <span class=\"artdeco-entity-lockup__degree \">· 1st</span>
<!----><!----></artdeco-entity-lockup-badge>
<artdeco-entity-lockup-subtitle id=\"ember391\" class=\"artdeco-entity-lockup__subtitle ember-view\"> <div class=\"t-14 t-black--light t-normal\">
<div id=\"ember393\" class=\"ember-view\"> <span class=\"lt-line-clamp__line lt-line-clamp__line--last\">
Founder & CEO @ Ayni Widny<!----></span>
<!----><span class=\"lt-line-clamp__ellipsis lt-line-clamp__ellipsis--dummy\">...</span></div>
</div>
</artdeco-entity-lockup-subtitle><artdeco-entity-lockup-caption id=\"ember394\" class=\"artdeco-entity-lockup__caption ember-view\"> <div class=\"truncate\">
’14 Management
</div>
</artdeco-entity-lockup-caption></artdeco-entity-lockup-content>
</artdeco-entity-lockup> <span>
<img class=\"lazy-image round-image EntityPhoto-circle-1 v-align-middle loaded\" alt=\"lionel’s profile picture\" src=\"https://media.licdn.com/dms/image/C4E03AQH3TWM5bEiO1g/profile-displayphoto-shrink_100_100/0?e=1565827200&v=beta&t=r1QXqaWKGQI3PAbSYD2EKibJLV2LyDNrWLJhiuUPGx8\" width=\"72\" height=\"72\">
<span class=\"t-12 t-black t-bold\">
26 shared connections
</span>
</span>
</div>
<footer class=\"artdeco-card__actions\">
<a data-control-name=\"people_profile_card_message_link\" target=\"_blank\" href=\"/messaging/compose/?connId=ACoAAAjQ0AABtNb896iwtKva5joQFIxDhxGBfAQ\" id=\"ember395\" class=\"artdeco-button artdeco-button--tertiary artdeco-button--fluid artdeco-button--3 ember-view\"> <span class=\"artdeco-button__text\">
Message
</span>
</a> </footer>
</section>
<section id=\"ember364\" class=\"artdeco-card artdeco-card--with-hover ember-view\"><!---->
<div class=\"org-people-profile-card__profile-info\">
<artdeco-entity-lockup stacked=\"center\" size=\"5\" id=\"ember365\" class=\"artdeco-entity-lockup--stacked-center artdeco-entity-lockup--size-5 artdeco-entity-lockup ember-view\"><artdeco-entity-lockup-image id=\"ember366\" class=\"artdeco-entity-lockup__image artdeco-entity-lockup__image--type-circle ember-view\" type=\"circle\"><a data-control-name=\"people_profile_card_image_link\" href=\"/in/clementinenannan/\" id=\"ember367\" class=\"ember-view\"> <img class=\"lazy-image loaded\" alt=\"Clémentine’s profile picture\" src=\"https://media.licdn.com/dms/image/C5603AQHR1X88QCWsnw/profile-displayphoto-shrink_100_100/0?e=1565827200&v=beta&t=fwXOyrczSApTvcE6A1gP-QZLIVMJ79A6L0d1dwdQ5CU\" width=\"72\" height=\"72\">
</a>
</artdeco-entity-lockup-image><artdeco-entity-lockup-content id=\"ember368\" class=\"artdeco-entity-lockup__content ember-view\"><artdeco-entity-lockup-title id=\"ember369\" class=\"artdeco-entity-lockup__title ember-view\"><a data-control-name=\"people_profile_card_name_link\" href=\"/in/clementinenannan/\" id=\"ember370\" class=\"link-without-visited-state ember-view\"> <div id=\"ember372\" class=\"org-people-profile-card__profile-title t-black lt-line-clamp lt-line-clamp--single-line ember-view\"> Clémentine lucie Nannan
<!----></div>
</a>
</artdeco-entity-lockup-title> <artdeco-entity-lockup-badge id=\"ember373\" class=\"artdeco-entity-lockup__badge ember-view\"> <span class=\"artdeco-entity-lockup__degree \">· 1st</span>
<!----><!----></artdeco-entity-lockup-badge>
<artdeco-entity-lockup-subtitle id=\"ember374\" class=\"artdeco-entity-lockup__subtitle ember-view\"> <div class=\"t-14 t-black--light t-normal\">
<div id=\"ember376\" class=\"ember-view\"> <span class=\"lt-line-clamp__line\">Marketing Management and</span>
<span class=\"lt-line-clamp__line lt-line-clamp__line--last\">
Digital student at ESSEC - F<span class=\"lt-line-clamp__ellipsis\">...
<!----> </span></span>
<!----><span class=\"lt-line-clamp__ellipsis lt-line-clamp__ellipsis--dummy\">...</span></div>
</div>
</artdeco-entity-lockup-subtitle><artdeco-entity-lockup-caption id=\"ember377\" class=\"artdeco-entity-lockup__caption ember-view\"> <div class=\"truncate\">
’18 Marketing
</div>
</artdeco-entity-lockup-caption></artdeco-entity-lockup-content>
</artdeco-entity-lockup> <span>
<img class=\"lazy-image round-image EntityPhoto-circle-1 v-align-middle loaded\" alt=\"Vincent’s profile picture\" src=\"https://media.licdn.com/dms/image/C4D03AQFq5VjBd4AgZQ/profile-displayphoto-shrink_100_100/0?e=1565827200&v=beta&t=Tt7tGo5BV12fhDTa0mMvj91f0WsArricQ0WpZXjSbKQ\" width=\"72\" height=\"72\">
<span class=\"t-12 t-black t-bold\">
24 shared connections
</span>
</span>
</div>
<footer class=\"artdeco-card__actions\">
<a data-control-name=\"people_profile_card_message_link\" target=\"_blank\" href=\"/messaging/compose/?connId=ACoAABMxF04BkeFqBF-OCOXN4MA1lD7R14Fw4zQ\" id=\"ember378\" class=\"artdeco-button artdeco-button--tertiary artdeco-button--fluid artdeco-button--3 ember-view\"> <span class=\"artdeco-button__text\">
Message
</span>
</a> </footer>
</section>";
// 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/