pub struct Matcher8<F> where
    F: Fn(&[u8]) -> Option<[Range<usize>; 8]>, 
{ /* private fields */ }
Expand description

A compiled regular expression with 8 capturing groups.

This is a zero-length type. The regex! macro generates a Rust type that implements the regular expression. This struct holds that type.

Implementations

This is used internally by the regex! macro.

Returns true if data matches the regular expression, otherwise returns false.

This is a whole-string match. For sub-string search, put .* at the beginning and end of the regex.

Example
use safe_regex::{regex, Matcher0};
let matcher: Matcher0<_> = regex!(br"[abc][0-9]*");
assert!(matcher.is_match(b"a42"));
assert!(!matcher.is_match(b"X"));

Executes the regular expression against the byte string data.

Returns Some((Range<u32>,Range<u32>,...)) if the expression matched all of the bytes in data. The tuple fields are ranges of bytes in data that matched capturing groups in the expression. A capturing group that matches no bytes will produce as a zero-length range.

This is a whole-string match. For sub-string search, put .* at the beginning and end of the regex.

Returns None if the expression did not match data.

Example
use safe_regex::{regex, Matcher3};
let matcher: Matcher3<_> = regex!(br"([abc])([0-9]*)(suffix)?");
let (prefix, digits, suffix) = matcher.match_ranges(b"a42").unwrap();
assert_eq!(0..1_usize, prefix);
assert_eq!(1..3_usize, digits);
assert_eq!(0..0_usize, suffix);

Executes the regular expression against the byte string data.

Returns Some((&[u8],&[u8],...)) if the expression matched all of the bytes in data. The tuple fields are slices of data that matched capturing groups in the expression.

This is a whole-string match. For sub-string search, put .* at the beginning and end of the regex.

Returns None if the expression did not match data.

Example
use safe_regex::{regex, Matcher3};
let matcher: Matcher3<_> = regex!(br"([abc])([0-9]*)(suffix)?");
let (prefix, digits, suffix) = matcher.match_slices(b"a42").unwrap();
assert_eq!(b"a", prefix);
assert_eq!(b"42", digits);
assert!(suffix.is_empty());

Trait Implementations

Returns true if data matches the regular expression, otherwise returns false. 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

Performs the conversion.

Performs the conversion.

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.