Struct pidgin::Matcher [−][src]
pub struct Matcher { pub rx: Regex, // some fields omitted }
This is functionally equivalent to a Regex
: you can use it repeatedly to
search a string. It cannot itself be used directly to split strings, but
its regular expression is public and may be so used. It improves on regular
expressions in that the Match
object it returns is the root node in a
parse tree, so its matches preserve parse structure.
Fields
rx: Regex
The Regex
used for parsing.
Methods
impl Matcher
[src]
impl Matcher
pub fn parse<'t>(&self, s: &'t str) -> Option<Match<'t>>
[src]
pub fn parse<'t>(&self, s: &'t str) -> Option<Match<'t>>
Returns Some(Match)
if the grammar can parse the string. Note that
unless the grammar is string-bounded, this only means it can parse
the string at some point.
pub fn is_match(&self, text: &str) -> bool
[src]
pub fn is_match(&self, text: &str) -> bool
Returns whether the grammar can parse the string. This is a cheaper operation than parsing.