// 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)(?<=\n)[A-Za-z ]{4,44}\s(\d{3}|\d{1}\w{2})").unwrap();
let string = "ROBERTO S.R.L.
Automotive Aftermarket
Roberto S.R.L., Str. Horia Macelariu nr. 30-34, RO-013937 Bucuresti
Capitalul Social: 169.363.000 Lei, Nr. Ord. Reg. com.: J40/7601/1994
Citibank Europe Plc Dublin, Romania Branch Citibank Europe Plc Dublin, Bulgaria Branch
SWIFT CODE: CITIROBU SWIFT CODE: CITIBGSF
IBAN RON: RO45 CITI 0000 0007 2488 3001 IBAN BGN: BG54 CITI 9250 1001 0086 00
IBAN EURO: RO48 CITI 0000 0007 2488 3044
Invoice 1/ 2
Document No.: 2045175575
Date: 09.01.2023
Sold To party: 22222222
Account No.: 22222222
ALFREDO GIOACCHINO OOD
ul. Andrey Germanov 11
BG-1336 MILANO
Your VAT No.: BG175423111
Our VAT No.: RO5541546
Contact Person Finance: VALENTINA IVANOVA
Phone: +35929601062
E-mail: Valentina.Ivanova@bg.rocco.com
Contacts: DIANA DOBREVA
Phone: 878668802
E-mail: external.Diana.Dobreva@bg.rocco.com
Sold To Address: ALFREDO GIOACCHINO OOD, ul. Andrey Germanov 11, BG-1336 MILANO, B
Item Material/Description Quantity Unit Price per unit Net Value BGN
Transport: 1180774272 Shipping Point: ADC/LDC DE, Karlsruhe Shipping Type: Truck
Ship To Party: 95100938 ALFREDO GIOACCHINO OOD
ul. Andrey Germanov 11
BG-1336 SOFIA
Delivery No.: 823025507 Delivery Date: 13.01.2023 Delivery Type: Standard Order AA
Your Order No.: 20230103-154257-011O From: 03.01.2023 Our Order No.: 210492510
10 Nozzle And Holder Assy 2 EA
Material: 0.432.231.664.80C
Material Entered: 0.432.231.664
EAN: 3165143215791
179,20 358,40
Dispatch element: 106650185 2 EA
20 Hole-Type Nozzle 4 EA
Material: 0.433.171.193.8GA
Material Entered: 0.433.171.193
EAN: 4047024542822
33,99 135,96
Dispatch element: 106650185 4 EA
Total net value: 494,36
VAT:* Z9 0,00 % 494,36 0,00
Invoice amount: 494,36
* Triangular transaction taxable at the customer according to Art. 141,2006/112/EC. This document is legally binding without signature.
Incoterms: DAP SOFIA
Payment terms: Up to 23.01.2023 you receive 2,000 % discount
Up to 08.02.2023 without deduction
Country of origin Index (represents the last three digits of part number)
Brazil 8GA
India 80CROBERTO S.R.L.
Automotive Aftermarket
Robert Bosch S.R.L., Str. Horia Macelariu nr. 30-34, RO-013937 Bucuresti
Capitalul Social: 169.363.000 Lei, Nr. Ord. Reg. com.: J40/7601/1994
Citibank Europe Plc Dublin, Romania Branch Citibank Europe Plc Dublin, Bulgaria Branch
SWIFT CODE: CITIROBU SWIFT CODE: CITIBGSF
IBAN RON: RO45 CITI 0000 0007 2488 3001 IBAN BGN: BG54 CITI 9250 1001 0086 00
IBAN EURO: RO48 CITI 0000 0007 2488 3044
Invoice 2/ 2
Document No.: 2045175575
Date: 09.01.2023
Sold To party: 95100938
Account No.: 95100938
Country of origin HS Code Quantity UoM Amount BGN
Brazil
84099900 4 EA 135,96
135,96
India
84099900 2 EA 358,40
358,40
Marking Dispatch element type Physical dimension of dispatch
element
Unit of
measure
Gross
Weight Unit of measure
106650185 Corrugated carton 246 166 123 MM 0,959 KG
Country of origin Item numbers Total amount
Brazil 20 135,96
India 10 358,40
Element type: Corrugated carton Number of elements: 1 0,959 KG";
// 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/