Struct rules::re::Regex
[−]
[src]
pub struct Regex(_);
Methods
impl Regex
[src]
fn new(s: &str) -> Regex
fn is_match(&self, s: &str) -> bool
Returns true if and only if the regex matches the string given.
Example
let pineapple = Regex::new(r"pine apple"); assert!(pineapple.is_match("I bought a pineapple.")); // Digit or `a`. `-` is set difference. let char_class = Regex::new(r"<[ 0 .. 9 a .. z] - [ b .. z ]>"); assert!(char_class.is_match("3")); assert!(char_class.is_match("a")); assert!(!char_class.is_match("b")); }