// 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)^NPWP:?\s*\K\d+").unwrap();
let string = "NPWP:016386112436000 JALAN ELANG DESA SUKAHATI CITEUREUP BOGOR 16810, INDONESIA TEL:+62(21)8765105
NPWP 314633389431000 DELTA SILICON INDUSTRIALL PARK 3 JL PINANG F 16/25A, CICAU CIKARANG PUSAT, CITY: BEKASI, JB 17550 INDONESIA";
// 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/