pub struct RegExpBuilder { /* private fields */ }
Expand description

This struct builds regular expressions from user-provided test cases.

Implementations

Specifies the test cases to build the regular expression from.

The test cases need not be sorted because RegExpBuilder sorts them internally.

⚠ Panics if test_cases is empty.

Specifies a text file containing test cases to build the regular expression from.

The test cases need not be sorted because RegExpBuilder sorts them internally.

Each test case needs to be on a separate line. Lines may be ended with either a newline (\n) or a carriage return with a line feed (\r\n). The final line ending is optional.

⚠ Panics if:

  • the file cannot be found
  • the file’s encoding is not valid UTF-8 data
  • the file cannot be opened because of conflicting permissions

Tells RegExpBuilder to convert any Unicode decimal digit to character class \d.

This method takes precedence over with_conversion_of_words if both are set. Decimal digits are converted to \d, the remaining word characters to \w.

This method takes precedence over with_conversion_of_non_whitespace if both are set. Decimal digits are converted to \d, the remaining non-whitespace characters to \S.

Tells RegExpBuilder to convert any character which is not a Unicode decimal digit to character class \D.

This method takes precedence over with_conversion_of_non_words if both are set. Non-digits which are also non-word characters are converted to \D.

This method takes precedence over with_conversion_of_non_whitespace if both are set. Non-digits which are also non-space characters are converted to \D.

Tells RegExpBuilder to convert any Unicode whitespace character to character class \s.

This method takes precedence over with_conversion_of_non_digits if both are set. Whitespace characters are converted to \s, the remaining non-digit characters to \D.

This method takes precedence over with_conversion_of_non_words if both are set. Whitespace characters are converted to \s, the remaining non-word characters to \W.

Tells RegExpBuilder to convert any character which is not a Unicode whitespace character to character class \S.

Tells RegExpBuilder to convert any Unicode word character to character class \w.

This method takes precedence over with_conversion_of_non_digits if both are set. Word characters are converted to \w, the remaining non-digit characters to \D.

This method takes precedence over with_conversion_of_non_whitespace if both are set. Word characters are converted to \w, the remaining non-space characters to \S.

Tells RegExpBuilder to convert any character which is not a Unicode word character to character class \W.

This method takes precedence over with_conversion_of_non_whitespace if both are set. Non-words which are also non-space characters are converted to \W.

Tells RegExpBuilder to detect repeated non-overlapping substrings and to convert them to {min,max} quantifier notation.

Tells RegExpBuilder to enable case-insensitive matching of test cases so that letters match both upper and lower case.

Tells RegExpBuilder to replace non-capturing groups by capturing ones.

Specifies the minimum quantity of substring repetitions to be converted if with_conversion_of_repetitions is set.

If the quantity is not explicitly set with this method, a default value of 1 will be used.

⚠ Panics if quantity is zero.

Specifies the minimum length a repeated substring must have in order to be converted if with_conversion_of_repetitions is set.

If the length is not explicitly set with this method, a default value of 1 will be used.

⚠ Panics if length is zero.

Tells RegExpBuilder to convert non-ASCII characters to unicode escape sequences. The parameter use_surrogate_pairs specifies whether to convert astral code planes (range U+010000 to U+10FFFF) to surrogate pairs.

Tells RegExpBuilder to produce a nicer looking regular expression in verbose mode.

Tells RegExpBuilder to remove the caret anchor ‘^’ from the resulting regular expression, thereby allowing to match the test cases also when they do not occur at the start of a string.

Tells RegExpBuilder to remove the dollar sign anchor ‘$’ from the resulting regular expression, thereby allowing to match the test cases also when they do not occur at the end of a string.

Tells RegExpBuilder to remove the caret and dollar sign anchors from the resulting regular expression, thereby allowing to match the test cases also when they occur within a larger string that contains other content as well.

Tells RegExpBuilder to provide syntax highlighting for the resulting regular expression.

⚠ This method may only be used if the resulting regular expression is meant to be printed to the console. The regex string representation returned from enabling this setting cannot be fed into the regex crate.

Builds the actual regular expression using the previously given settings.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.