Struct qt_core::q_regular_expression::PatternOption
source · pub struct PatternOption(/* private fields */);
Expand description
The PatternOption enum defines modifiers to the way the pattern string should be interpreted, and therefore the way the pattern matches against a subject string.
C++ enum: QRegularExpression::PatternOption
.
The PatternOption enum defines modifiers to the way the pattern string should be interpreted, and therefore the way the pattern matches against a subject string.
The PatternOptions type is a typedef for QFlags<PatternOption>. It stores an OR combination of PatternOption values.
Implementations§
source§impl PatternOption
impl PatternOption
sourcepub const NoPatternOption: PatternOption = _
pub const NoPatternOption: PatternOption = _
No pattern options are set. (C++ enum variant: NoPatternOption = 0
)
sourcepub const CaseInsensitiveOption: PatternOption = _
pub const CaseInsensitiveOption: PatternOption = _
The pattern should match against the subject string in a case insensitive way. This option corresponds to the /i modifier in Perl regular expressions. (C++ enum variant: CaseInsensitiveOption = 1
)
sourcepub const DotMatchesEverythingOption: PatternOption = _
pub const DotMatchesEverythingOption: PatternOption = _
The dot metacharacter (.
) in the pattern string is allowed to match any character in the subject string, including newlines (normally, the dot does not match newlines). This option corresponds to the /s
modifier in Perl regular expressions. (C++ enum variant: DotMatchesEverythingOption = 2
)
sourcepub const MultilineOption: PatternOption = _
pub const MultilineOption: PatternOption = _
The caret (^
) and the dollar ($
) metacharacters in the pattern string are allowed to match, respectively, immediately after and immediately before any newline in the subject string, as well as at the very beginning and at the very end of the subject string. This option corresponds to the /m
modifier in Perl regular expressions. (C++ enum variant: MultilineOption = 4
)
sourcepub const ExtendedPatternSyntaxOption: PatternOption = _
pub const ExtendedPatternSyntaxOption: PatternOption = _
Any whitespace in the pattern string which is not escaped and outside a character class is ignored. Moreover, an unescaped sharp (#) outside a character class causes all the following characters, until the first newline (included), to be ignored. This can be used to increase the readability of a pattern string as well as put comments inside regular expressions; this is particulary useful if the pattern string is loaded from a file or written by the user, because in C++ code it is always possible to use the rules for string literals to put comments outside the pattern string. This option corresponds to the /x
modifier in Perl regular expressions. (C++ enum variant: ExtendedPatternSyntaxOption = 8
)
sourcepub const InvertedGreedinessOption: PatternOption = _
pub const InvertedGreedinessOption: PatternOption = _
The greediness of the quantifiers is inverted: ,
+
, ?
, {m,n}
, etc. become lazy, while their lazy versions (?
, +?
, ??
, {m,n}?
, etc.) become greedy. There is no equivalent for this option in Perl regular expressions. (C++ enum variant: InvertedGreedinessOption = 16
)
sourcepub const DontCaptureOption: PatternOption = _
pub const DontCaptureOption: PatternOption = _
The non-named capturing groups do not capture substrings; named capturing groups still work as intended, as well as the implicit capturing group number 0 corresponding to the entire match. There is no equivalent for this option in Perl regular expressions. (C++ enum variant: DontCaptureOption = 32
)
sourcepub const UseUnicodePropertiesOption: PatternOption = _
pub const UseUnicodePropertiesOption: PatternOption = _
The meaning of the \w
, \d
, etc., character classes, as well as the meaning of their counterparts (\W
, \D
, etc.), is changed from matching ASCII characters only to matching any character with the corresponding Unicode property. For instance, \d
is changed to match any character with the Unicode Nd (decimal digit) property; \w
to match any character with either the Unicode L (letter) or N (digit) property, plus underscore, and so on. This option corresponds to the /u
modifier in Perl regular expressions. (C++ enum variant: UseUnicodePropertiesOption = 64
)
sourcepub const OptimizeOnFirstUsageOption: PatternOption = _
pub const OptimizeOnFirstUsageOption: PatternOption = _
The regular expression will be optimized (and possibly JIT-compiled) on its first usage, instead of after a certain (undefined) number of usages. See also optimize(). This enum value has been introduced in Qt 5.4. (C++ enum variant: OptimizeOnFirstUsageOption = 128
)
sourcepub const DontAutomaticallyOptimizeOption: PatternOption = _
pub const DontAutomaticallyOptimizeOption: PatternOption = _
Regular expressions are automatically optimized after a certain number of usages; setting this option prevents such optimizations, therefore avoiding possible unpredictable spikes in CPU and memory usage. If both this option and the OptimizeOnFirstUsageOption
option are set, then this option takes precedence. Note: this option will still let the regular expression to be optimized by manually calling optimize(). This enum value has been introduced in Qt 5.4. (C++ enum variant: DontAutomaticallyOptimizeOption = 256
)
Trait Implementations§
source§impl<T: Into<QFlags<PatternOption>>> BitOr<T> for PatternOption
impl<T: Into<QFlags<PatternOption>>> BitOr<T> for PatternOption
§type Output = QFlags<PatternOption>
type Output = QFlags<PatternOption>
|
operator.source§impl Clone for PatternOption
impl Clone for PatternOption
source§fn clone(&self) -> PatternOption
fn clone(&self) -> PatternOption
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PatternOption
impl Debug for PatternOption
source§impl From<PatternOption> for QFlags<PatternOption>
impl From<PatternOption> for QFlags<PatternOption>
source§fn from(value: PatternOption) -> Self
fn from(value: PatternOption) -> Self
source§impl From<PatternOption> for c_int
impl From<PatternOption> for c_int
source§fn from(value: PatternOption) -> Self
fn from(value: PatternOption) -> Self
source§impl From<i32> for PatternOption
impl From<i32> for PatternOption
source§impl PartialEq for PatternOption
impl PartialEq for PatternOption
source§fn eq(&self, other: &PatternOption) -> bool
fn eq(&self, other: &PatternOption) -> bool
self
and other
values to be equal, and is used
by ==
.