// 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)^[a-z]\..*$").unwrap();
let string = "Instead of strings like \" .*(?=\\.)\"
Lets have:
matchCriteria:
..... str from source
..... where
..... str startswith Text.Anything
# until one before period
..... until (source endswith Chars.Period) - 1
Possibly a markup language (RegXML) that will store RegExp information for SOA messaging.
And a search tool for the desktop and for the web, with a WYSIWYG regexp editor that works as follows on any text:
a. Load sample or text to search.
b. Mouse over and mark the words or \"sections\" you are intending to search for inside the text.
c. As you mark, each section is given its definitions: if its from the beginning or till the end of a word it will give the possible [b]Word (starting/ending/exactly) with markedword[b].
d. When standing on a section, you can mark it as being a \"formatted text\" or other. (if the section has slashes, hyphens and periods etc, it will suggest this automatically).
e. Famous formats can be chosen and automatically detected.
For example: Search for format of date: where day is: (any/between/less than) etc.
f. Didn't think out the REPLACE functionality yet.";
// 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/