// 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)\\VariantSimple=((?:\([^\)]+\))*) \\Processed=((?:\([^\)]+\))*) ([\s\S]*?)(?:>|$)").unwrap();
let string = ">nxp:NX_A0A0A6YYD4-1 \\PName=T cell receptor beta variable 13 isoform Iso 1 \\GName=TRBV13 \\NcbiTaxId=9606 \\TaxName=Homo Sapiens \\Length=124 \\SV=5 \\EV=31 \\PE=3 \\ModResPsi=(52|MOD:00798|half cystine)(120|MOD:00798|half cystine) \\ModRes=(106||N-linked (GlcNAc...) asparagine) \\VariantSimple=(18|H)(27|V) \\Processed=(1|31|PEFF:0001021|signal peptide)(32|124|PEFF:0001020|mature protein) MLSPDLPDSAWNTRLLCRVMLCLLGAGSVAAGVIQSPRHLIKEKRETATLKCYPIPRHDT VYWYQQGPGQDPQFLISFYEKMQSDKGSIPDRFSAQQFSDYHSELNMSSLELGDSALYFC ASSL
>nxp:NX_A0A1B0GV90-1 \\PName=Cortexin domain containing 2 isoform Iso 1 \\GName=CTXND2 \\NcbiTaxId=9606 \\TaxName=Homo Sapiens \\Length=55 \\SV=1 \\EV=11 \\PE=3 \\VariantSimple=(13|N)(22|F)(29|T)(34|Q)(45|T) \\Processed=(1|55|PEFF:0001020|mature protein) MEDSSLSSGVDVDKGFAIAFVVLLFLFLIVMIFRCAKLVKNPYKASSTTTEPSLS";
// 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/