Function regex_literal::delimited::set_delimiter
source · pub fn set_delimiter(delimiter: &[u8]) -> bool
Expand description
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.
A regular expression literal (reliteral) is enclosed by delimiters. A pair of forwardslashes – “/pattern_text/” originally from the matching operator in Perl1, is used as the default delimiters in reliteral, which makes itself distinct from the other Rust literal expressions
Any delimiter sequence in the pattern text of reliteral is prepended with a backslash. To avoid using too many escaped backslashe, reliteral delimiter can be customised.