Expand description

regex-intersect is a library for finding out if two regexes have a non-empty intersection.

For example .* and abc obviously intersect (because .* matches everything, including the string “abc”). However, d.* and abc or a[h-z]c and abc do not, and could never intersect, because abc could never start with a d in the first case, and b is not in the set [h-z] in the second case.

Examples

Check if non empty:

use regex_intersect::non_empty;
assert!(non_empty("a.*", "ab.*cd").expect("regex expressions should parse"))

Tracing

This libary incorporates tracing, which helps follow the way it operates. Tracing is not enabled by default but you can enable it:

regex-intersect = { version="0.1", features=["tracing"] }

Enums

An error in intersecting expressions

Functions

Check if left and right contains a non empty intersection.