// 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"([^\.!\?|\{\}]+[\.!\?]+(?:[a-z]+[\.!\?]+)?)").unwrap();
let string = "<h3>{h3A1 | h3B1 | h3C1 | h3D1 | h3E1 | h3F1 }</h3>
{<h5>{h5A|h5B|h5C|h5D|h5E}</h5>|}
<p>{
{pA1. |pB1. } {pC1. |pD1. } {pE1. |pF1. }
|
{ppA2. |ppB2. } {ppC2. |ppD2. } {ppE2.|ppF2. }
}</p>
{<h5>{A|B|C|D|E}</h5>|}
<p>{{A. |B. } {C. |D. } {E. |F. }|{A. |B. } {C. |D.} {E. |F. }}</p> {<h5>{Getting the Best Google Maps Driving Directions | A History of Google Maps Driving Directions Refuted | The War Against Google Maps Driving Directions | If You Read Nothing Else Today, Read This Report on Google Maps Driving Directions | Facts, Fiction and Google Maps Driving Directions | What's Really Happening with Google Maps Driving Directions}</h5>|} <p>{{Whenever you would like to travel, the greatest worry is to receive the place quickly with the finest route. |It is a very major world and it's also quite easy to get lost in it if you really do not have precise directions on where you're going. } {When you're going to a certain address, you'll need to get an elaborated map of that particular location so you are able for exact and dependable directions to navigate your journey with nominal problems. |You might also want to search the country of Japan to choose where you want to see, just by typing in 'Japan'. } {You can chose directions predicated on travel time or travel distance along with the web site will calculate a number of different routes if you're not happy with the initial one provided. |Not to worry, I've developed an application that may be placed on nearly every site and generate a map and driving directions. }|{Gone are the times when you really need to hold a map in your hand to understand where you're going. |This is really a subject that everybody should know something about and within this article you'll be able to find out a number of the simple details you may need.} {This may save you quite a modicum of time in the event you frequently are looking up driving directions. |If you save that link for a bookmark or inside a Word document, then you are going to have the ability to access exactly the same group of directions for next time.} {If you're not close to the phone or have a voicemail system, you need to select postcard verification. |You're able to get to your own destination stress free, and truly feel great.}}</p> <p>{Now say you're in the auto driving but do not have any idea exactly where you are. |I like the simple to read instructions. } {It even lets you know how far it is to the following turn. |Hence you might lose out on brand new, short, alternate paths. } {Unfortunately there's not a established answer for this particular question. |Ergo, just since you might need to have a few detours on the way, so you could need to change your life roadmap from now and then. } {Don't forget, though, your fellow won't have a memory of the tiny incident. |This is helpful to recognize whenever you're approaching turns or exits and gives a major advantage on a standard map such as the ones you will discover with MapQuest.com. } {We're presented with detailed directions and possibly even pictures to create the trip as painless as possible. |But however this might not be the least path. }</p>";
// 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/