// 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"(?<=(?i)gleason)[\w\s\p{P}\=]*[^0-9\.\+]*\s*\K(\d)\s*\+\s*(\d)(?=\D)").unwrap();
let string = "ajnxaslndsa;ndaJDASDNsadnKDNadk;NADK'nadkAnaskdmaskdnajfbajfnakdnaj;knasjnakdna;jkdna;nda;dna;kdnas;dkns
so as sadasldka aldaskl . asdas asd 5,400 cgy
40.00 cgy
4 cgy
gleason score 7/10(4+3), = 7 )
1.1- 0.6,df
2,4-3,6 asdf 4+5+6
gleason's pattern: 2+3, 5
gleason score = 5(2+3)
score 1+2, (score 7)
gleason Dec 2011-23 jan
500,000.012 cgy sdfsfsodm sdfsd f
sdfsd afdas. s adasas dasd as
asdasdaskd askdm askdmas'ljdnas;das.ndaskjndajkndWJDNAksz
gleason score 9, 4+5=9/10,
PSA = 27.60, 8 specimens
{0,1SDf00}
10% 20%
(?<=(?i)gleason)[\\w\\s\\p{P}\\=]*[^0-9\\.\\+]*\\s*\\K(\\d)\\s*\\+\\s*(\\d)(?=\\D)
(?<=(?i)gleason)[\\w\\s\\p{P}\\=]*[^0-9\\.\\-]*\\s*\\K(\\d)\\s*\\-\\s*(\\d)(?=\\D\\-)
(?<=(?i)gleason)[\\w\\s\\p{P}\\=]*[^0-9\\.\\,\\#]*\\s*\\K(\\d)\\s*\\,\\s*(\\d)(?=\\D)
[\\w\\s\\p{P}\\=]*[^0-9\\.\\+]*\\s*\\K(\\d)\\s*\\+\\s*(\\d)(?=\\D)
[\\w\\s\\p{P}\\=]*[^0-9\\.\\-]*\\s*\\K(\\d)\\s*\\+\\s*(\\d)(?=\\D\\-)
(?<=[\\\\s])\\\\s*|^\\\\s+|\\\\s+$
";
// 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/