pub struct RDFRegex { /* private fields */ }Expand description
A regular expression for RDF and SPARQL pattern matching.
This type wraps the Rust Regex type with SPARQL/XPath-compatible flag
handling. It stores both the compiled regex and the original pattern with
flags for display and debugging purposes.
Implementations§
Source§impl RDFRegex
impl RDFRegex
Sourcepub fn new(pattern: &str, flags: Option<&str>) -> Result<Self, RDFRegexError>
pub fn new(pattern: &str, flags: Option<&str>) -> Result<Self, RDFRegexError>
Creates a new regular expression with SPARQL-compatible flags.
This constructor builds a regex following the XPath/SPARQL flag semantics, which differ slightly from standard Rust regex flags. The implementation is inspired by the Oxigraph SPARQL engine (https://github.com/oxigraph/oxigraph/blob/main/lib/spareval/src/eval.rs).
§Arguments
pattern- The regular expression pattern stringflags- Optional string containing flag characters (see below)
§Supported Flags
Following the XPath specification:
s(dot-all): Makes.match any character including newlinesm(multi-line): Makes^and$match line boundaries, not just string boundariesi(case-insensitive): Performs case-insensitive matchingx(ignore whitespace): Ignores unescaped whitespace and enables comments with#q(quote/literal): Treats the entire pattern as a literal string (escapes special characters)
Flags can be combined, e.g., "im" for case-insensitive multi-line matching.
§Size Limits
The compiled regex is limited to [REGEX_SIZE_LIMIT] bytes. Patterns
exceeding this limit will fail with an error.
§Errors
Returns an error if:
- The pattern syntax is invalid (e.g., unbalanced parentheses, invalid escape sequences)
- An unsupported flag character is provided
- The compiled regex exceeds the size limit
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RDFRegex
impl RefUnwindSafe for RDFRegex
impl Send for RDFRegex
impl Sync for RDFRegex
impl Unpin for RDFRegex
impl UnsafeUnpin for RDFRegex
impl UnwindSafe for RDFRegex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.