Struct regress::Regex[][src]

pub struct Regex { /* fields omitted */ }
Expand description

A Regex is the compiled version of a pattern.

Implementations

Construct a regex by parsing pattern using the default flags. An Error may be returned if the syntax is invalid. Note that this is rather expensive; prefer to cache a Regex which is intended to be used more than once.

Construct a regex by parsing pattern with flags. An Error may be returned if the syntax is invalid. Note it is preferable to cache a Regex which is intended to be used more than once, as the parse may be expensive. For example:

Searches text to find the first match.

Searches text, returning an iterator over non-overlapping matches. Note that the resulting Iterator borrows both the regex 'r and the input string as 't.

Returns an iterator for matches found in ‘text’ starting at byte index start. Note this may be different from passing a sliced text in the case of lookbehind assertions. Example:

 use regress::Regex;
 let text = "xyxy";
 let re = Regex::new(r"(?<=x)y").unwrap();
 let t1 = re.find(&text[1..]).unwrap().range();
 assert!(t1 == (2..3));
 let t2 = re.find_from(text, 1).next().unwrap().range();
 assert!(t2 == (1..2));

Searches text to find the first match. The input text is expected to be ascii-only: only ASCII case-folding is supported.

Searches text, returning an iterator over non-overlapping matches. The input text is expected to be ascii-only: only ASCII case-folding is supported.

Returns an iterator for matches found in ‘text’ starting at byte index start.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempts to parse a string into a regular expression

The associated error which can be returned from parsing.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.