Module regex_literal::delimited

source ·
Expand description

§The core module of delimited literals

crate::delimited defines an enumeration type XRegex that represents a choice from Regex struct and ReSequence structs. Its associated functions try_from and from_str call parse and compile functions sebsequently that convert any delimited regular expression literal into compiled struct via a intermediate data BTreeMap<u32,Meta>.

Structs§

  • An error that occurs when construction of a Regex fails.
  • The parameters for a regex search including the haystack to search.
  • A representation of a match reported by a regex engine.
  • The identifier of a regex pattern, represented by a SmallIndex.
  • ReSequence is the sequence of regex_automata::Regex (can be either single-pattern or multiple-pattern) that can be utilized in a timeline /series of matching events.
  • A regex matcher that works by composing several other regex matchers automatically.
  • A representation of a span reported by a regex engine.
  • a collection of regular expression data artifacts

Enums§

  • The type of anchored search to perform.
  • An error that occurred during parsing or compiling a regular expression.
  • identifiers for regex literal kinds

Constants§

Statics§

  • DELIMITER_CHARS is a collection of punctuations for composing regular expression delimiters. It consists of the following punctuations: !#$%&*+,./:;=?@^_|~-
  • the punctuations used as the SEPARATORs among items in regex sets (regex union and sequence)
  • the punctuations used as the delimiters in regex sets (regex union and sequence)

Functions§

  • function set_delimiter customises delimiters for regex literal. The passed delimiter value (as a byte array) consists of 1 or upto 4 single-byte characters. It is firstly validated against DELIMITER_CHARS; and then is converted into u32 and stored in thread_local static DELIMITER and the function returns true if it is valid; otherwise DELIMITER is not updated and the function reuturns false.
  • function validate_delimiter checks delimiter against DELIMITER_CHARS, A byte sequence that consists of either one single candidate puncutation or multiple repeated ones is valid for enclosing pattern text. Note bracket style delimiters in many PCRE (Perl Compatible Regular Expressions ) engines are excluded from DELIMITER_CHARS, as they are reserved for delimiting elements in regex sets.