Struct spinoso_regexp::Utf8

source ·
pub struct Utf8 { /* private fields */ }

Implementations

Construct a Regexp with a UTF-8 regex backend.

The constructed regexp is Unicode aware. All character classes used in patterns other than POSIX character classes support all of Unicode.

Utf8 regexps require their patterns and haystacks to be valid UTF-8.

Examples
let pattern = br"[[:alpha:]]\d+ \d+";
let source = Source::with_pattern_and_options(pattern.to_vec(), Options::default());
let config = Config::from(&source);
let regexp = Utf8::with_literal_derived_encoding(source, config, Encoding::None)?;
assert!(regexp.is_match("a123 १०೩೬".as_bytes(), None)?);
Errors

If the pattern in the given source is not valid UTF-8, an ArgumentError is returned. If the given source pattern fails to parse, either a SyntaxError or RegexpError is returned depending on the source Options.

Errors

If the given haystack is not valid UTF-8, an error is returned.

Returns the number of captures.

The number of captures for a match of haystack against this regexp.

Captures represents a group of captured strings for a single match.

If there is a match, the returned value is always greater than 0; the 0th capture always corresponds to the entire match.

Errors

If the given haystack is not valid UTF-8, an error is returned.

Return the 0th capture group if haystack is matched by this regexp.

The 0th capture always corresponds to the entire match.

Errors

If the given haystack is not valid UTF-8, an error is returned.

Returns a hash representing information about the named captures of this Regexp.

A key of the hash is a name of the named captures. A value of the hash is an array which is list of indexes of corresponding named captures.

Errors

If the given haystack is not valid UTF-8, an error is returned.

Errors

If the given haystack is not valid UTF-8, an error is returned.

Check whether this regexp matches the given haystack starting at an offset.

If the given offset is negative, it counts backward from the end of the haystack.

Errors

If the given haystack is not valid UTF-8, an error is returned.

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
Formats the value using the given formatter. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. 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.