// 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)^[\w\s./-]*(?:\s\d+){4}(?:\s\$\d+\.\d+){2}$").unwrap();
let string = "Amount
2144-PL
1XL 2XL 3XL
2144-
PL Navy Blue 2 2 2 6 $11.50 $69.00
ETK-2097K-PL PLUS-TOP - BACK BUTTON TUNICS 95% RAYON 5% SPANDEX MADE IN USA
1XL 2XL 3XL
Black 2 2 2 6 $12.00 $72.00
Teal 2 2 2 6 $12.00 $72.00
ETK-2197-SW-
1XL 2XL 3XL
PL ETK-
2197- H.Grey/Burgu… 2 2 2 6 $14.00 $84.00
Off-White/Black 1 1 1 3 $14.00 $42.00
ETK-2143 Tops - 95% RAYON 5% SPANDEX MADE IN USA
S M L
Heather Grey 2 2 2 6 $10.50 $63.00
Royal Blue 2 2 2 6 $10.50 $63.00
Ruby Red 2 2 2 6 $10.50 $63.00
ETK2186-GD- Tops-Stripe Solid-95% Rayon 5% Spandex Made in USA
PL
1XL 2XL 3XL
Burgundy/Bur… 2 2 2 6 $11.00 $66.00
Ivory/Black 2 2 2 6 $11.00 $66.00
2139 - WP-PL PLUS TOP -95% RAYON 5% SPANDEX MADE IN USA
1XL 2XL 3XL
As Shown 2 2 2 6 $9.50 $57.00
ETK-2228
S M L
ETK-
2228 Off-White/Black 2 2 2 6 $9.50 $57.00
ETK-2149-PL
1XL 2XL 3XL
ETK-
2149- Taupe 2 2 2 6 $11.50 $69.00
BACK
ORDERED
White 2 2 2 6 $11.50 $69.00
Sub";
// 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/