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.

C++ documentation:

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

source

pub fn to_int(&self) -> c_int

source§

impl PatternOption

source

pub const NoPatternOption: PatternOption = _

No pattern options are set. (C++ enum variant: NoPatternOption = 0)

source

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)

source

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)

source

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)

source

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)

source

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)

source

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)

source

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)

source

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)

source

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

§

type Output = QFlags<PatternOption>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: T) -> QFlags<PatternOption>

Performs the | operation. Read more
source§

impl Clone for PatternOption

source§

fn clone(&self) -> PatternOption

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PatternOption

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<PatternOption> for QFlags<PatternOption>

source§

fn from(value: PatternOption) -> Self

Converts to this type from the input type.
source§

impl From<PatternOption> for c_int

source§

fn from(value: PatternOption) -> Self

Converts to this type from the input type.
source§

impl From<i32> for PatternOption

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for PatternOption

source§

fn eq(&self, other: &PatternOption) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for PatternOption

source§

impl Eq for PatternOption

source§

impl StructuralEq for PatternOption

source§

impl StructuralPartialEq for PatternOption

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.