PythonQt.QtCore.QRegularExpression · declarations 001
Back to PythonQt.QtCore.QRegularExpression
AnchoredMatchOption
instance-attribute
AnchoredMatchOption: Any
CaseInsensitiveOption
instance-attribute
CaseInsensitiveOption: Any
DontAutomaticallyOptimizeOption
instance-attribute
DontAutomaticallyOptimizeOption: Any
DontCaptureOption
instance-attribute
DontCaptureOption: Any
DontCheckSubjectStringMatchOption
instance-attribute
DontCheckSubjectStringMatchOption: Any
DotMatchesEverythingOption
instance-attribute
DotMatchesEverythingOption: Any
ExtendedPatternSyntaxOption
instance-attribute
ExtendedPatternSyntaxOption: Any
InvertedGreedinessOption
instance-attribute
InvertedGreedinessOption: Any
MatchOption
instance-attribute
MatchOption: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
MatchOptions
instance-attribute
MatchOptions: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
MatchType
instance-attribute
MatchType: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
MultilineOption
instance-attribute
MultilineOption: Any
NoMatch
instance-attribute
NoMatch: Any
NoMatchOption
instance-attribute
NoMatchOption: Any
NoPatternOption
instance-attribute
NoPatternOption: Any
NormalMatch
instance-attribute
NormalMatch: Any
OptimizeOnFirstUsageOption
instance-attribute
OptimizeOnFirstUsageOption: Any
PartialPreferCompleteMatch
instance-attribute
PartialPreferCompleteMatch: Any
PartialPreferFirstMatch
instance-attribute
PartialPreferFirstMatch: Any
PatternOption
instance-attribute
PatternOption: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
PatternOptions
instance-attribute
PatternOptions: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
UseUnicodePropertiesOption
instance-attribute
UseUnicodePropertiesOption: Any
captureCount
captureCount() -> int
X.captureCount() -> int
Supplemental documentation: Qt 5 reference:
int QRegularExpression::captureCount() const
Returns the number of capturing groups inside the pattern string, or -1 if the regular expression is not valid.
Note: The implicit capturing group 0 is not included in the returned number.
See also isValid().
Upstream PySide2 reference signatures (binding differences may apply):
captureCount(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#captureCount
errorString
errorString() -> str
X.errorString() -> str
Supplemental documentation: Qt 5 reference:
QString QRegularExpression::errorString() const
Returns a textual description of the error found when checking the validity of the regular expression, or "no error" if no error was found.
See also isValid() and patternErrorOffset().
Upstream PySide2 reference signatures (binding differences may apply):
errorString(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#errorString
escape
escape(str: str) -> str
X.escape(str) -> str
Supplemental documentation: Qt 5 reference:
[static] QString QRegularExpression::escape(QStringView str)
Escapes all characters of str so that they no longer have any special meaning when used as a regular expression pattern string, and returns the escaped string. For instance:
QString escaped = QRegularExpression::escape("a(x) = f(x) + g(x)");
// escaped == "a\\(x\\)\\ \\=\\ f\\(x\\)\\ \\+\\ g\\(x\\)"
This is very convenient in order to build patterns from arbitrary strings:
QString pattern = "(" + QRegularExpression::escape(name) +
"|" + QRegularExpression::escape(nickname) + ")";
QRegularExpression re(pattern);
Note: This function implements Perl's quotemeta algorithm and escapes with a
backslash all characters in str, except for the characters in the [A-Z], [a-z] and
[0-9] ranges, as well as the underscore (_) character. The only difference with Perl
is that a literal NUL inside str is escaped with the sequence "\\0" (backslash +
'0'), instead of "\\\0" (backslash + NUL).
This function was introduced in Qt 5.15.
[static] QString QRegularExpression::escape(const QString \&str)
This is an overloaded function.
Upstream PySide2 reference signatures (binding differences may apply):
escape(str: str) -> str
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#escape
globalMatch
globalMatch(subject: Any, offset: int, matchType: Any, matchOptions: Any) -> Any
X.globalMatch(subject, offset, matchType, matchOptions) -> PythonQt.QtCore.QRegularExpressionMatchIterator
Supplemental documentation: Qt 5 reference:
QRegularExpressionMatchIterator QRegularExpression::globalMatch(const QString \&subject, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= NoMatchOption) const
Attempts to perform a global match of the regular expression against the given subject string, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatchIterator is positioned before the first match result (if any).
See also QRegularExpressionMatchIterator and global matching.
QRegularExpressionMatchIterator QRegularExpression::globalMatch(const QStringRef \&subjectRef, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= NoMatchOption) const
This is an overloaded function.
Attempts to perform a global match of the regular expression against the given subjectRef string reference, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatchIterator is positioned before the first match result (if any).
This function was introduced in Qt 5.5.
See also QRegularExpressionMatchIterator and global matching.
QRegularExpressionMatchIterator QRegularExpression::globalMatch(QStringView subject, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= NoMatchOption) const
This is an overloaded function.
Attempts to perform a global match of the regular expression against the given subject string, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatchIterator is positioned before the first match result (if any).
Note: This overload has been added in 5.15.2 to simplify writing code that is portable between Qt 5.15 and Qt 6. The implementation is not tuned for performance in Qt 5.
This function was introduced in Qt 5.15.2.
See also QRegularExpressionMatchIterator and global matching.
Upstream PySide2 reference signatures (binding differences may apply):
globalMatch(self, subject: str, offset: int=..., matchType: PySide2.QtCore.QRegularExpression.MatchType=..., matchOptions: PySide2.QtCore.QRegularExpression.MatchOptions=...) -> PySide2.QtCore.QRegularExpressionMatchIterator
globalMatch(self, subjectRef: str, offset: int=..., matchType: PySide2.QtCore.QRegularExpression.MatchType=..., matchOptions: PySide2.QtCore.QRegularExpression.MatchOptions=...) -> PySide2.QtCore.QRegularExpressionMatchIterator
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#globalMatch
isValid
isValid() -> bool
X.isValid() -> bool
Supplemental documentation: Qt 5 reference:
bool QRegularExpression::isValid() const
Returns true if the regular expression is a valid regular expression (that is, it
contains no syntax errors, etc.), or false otherwise. Use
errorString()
to obtain a textual description of the error.
See also errorString() and patternErrorOffset().
Upstream PySide2 reference signatures (binding differences may apply):
isValid(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#isValid
match
match(subject: Any, offset: int, matchType: Any, matchOptions: Any) -> Any
X.match(subject, offset, matchType, matchOptions) -> PythonQt.QtCore.QRegularExpressionMatch
Supplemental documentation: Qt 5 reference:
QRegularExpressionMatch QRegularExpression::match(const QString \&subject, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= ...) const
Attempts to match the regular expression against the given subject string, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatch object contains the results of the match.
See also QRegularExpressionMatch and normal matching.
QRegularExpressionMatch QRegularExpression::match(const QStringRef \&subjectRef, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= NoMatchOption) const
This is an overloaded function.
Attempts to match the regular expression against the given subjectRef string reference, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatch object contains the results of the match.
This function was introduced in Qt 5.5.
See also QRegularExpressionMatch and normal matching.
QRegularExpressionMatch QRegularExpression::match(QStringView subject, int offset \= 0, QRegularExpression::MatchType matchType \= NormalMatch, QRegularExpression::MatchOptions matchOptions \= NoMatchOption) const
This is an overloaded function.
Attempts to match the regular expression against the given subjectRef string reference, starting at the position offset inside the subject, using a match of type matchType and honoring the given matchOptions.
The returned QRegularExpressionMatch object contains the results of the match.
Note: This overload has been added in 5.15.2 to simplify writing code that is portable between Qt 5.15 and Qt 6. The implementation is not tuned for performance in Qt 5.
This function was introduced in Qt 5.15.2.
See also QRegularExpressionMatch and normal matching.
Upstream PySide2 reference signatures (binding differences may apply):
match(self, subject: str, offset: int=..., matchType: PySide2.QtCore.QRegularExpression.MatchType=..., matchOptions: PySide2.QtCore.QRegularExpression.MatchOptions=...) -> PySide2.QtCore.QRegularExpressionMatch
match(self, subjectRef: str, offset: int=..., matchType: PySide2.QtCore.QRegularExpression.MatchType=..., matchOptions: PySide2.QtCore.QRegularExpression.MatchOptions=...) -> PySide2.QtCore.QRegularExpressionMatch
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#match
namedCaptureGroups
namedCaptureGroups() -> tuple
X.namedCaptureGroups() -> tuple
Supplemental documentation: Qt 5 reference:
QStringList QRegularExpression::namedCaptureGroups() const
Returns a list of
captureCount()
+ 1 elements, containing the names of the named capturing groups in the pattern string.
The list is sorted such that the element of the list at position i is the name of the
i-th capturing group, if it has a name, or an empty string if that capturing group is
unnamed.
For instance, given the regular expression
(?<day>\d\d)-(?<month>\d\d)-(?<year>\d\d\d\d) (\w+) (?<name>\w+)
namedCaptureGroups() will return the following list:
("", "day", "month", "year", "", "name")
which corresponds to the fact that the capturing group #0 (corresponding to the whole match) has no name, the capturing group #1 has name "day", the capturing group #2 has name "month", etc.
If the regular expression is not valid, returns an empty list.
This function was introduced in Qt 5.1.
See also isValid(), QRegularExpressionMatch::captured(), and QString::isEmpty().
Upstream PySide2 reference signatures (binding differences may apply):
namedCaptureGroups(self) -> typing.List[str]
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#namedCaptureGroups
operator_assign
operator_assign(re: Any) -> Any
X.operator_assign(re) -> PythonQt.QtCore.QRegularExpression
optimize
optimize() -> None
X.optimize()
Supplemental documentation: Qt 5 reference:
void QRegularExpression::optimize() const
Compiles the pattern immediately, including JIT compiling it (if the JIT is enabled) for optimization.
This function was introduced in Qt 5.4.
See also isValid() and Debugging Code that Uses QRegularExpression.
Upstream PySide2 reference signatures (binding differences may apply):
optimize(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#optimize
pattern
pattern() -> str
X.pattern() -> str
Supplemental documentation: Qt 5 reference:
QString QRegularExpression::pattern() const
Returns the pattern string of the regular expression.
See also setPattern() and patternOptions().
Upstream PySide2 reference signatures (binding differences may apply):
pattern(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#pattern
patternErrorOffset
patternErrorOffset() -> int
X.patternErrorOffset() -> int
Supplemental documentation: Qt 5 reference:
int QRegularExpression::patternErrorOffset() const
Returns the offset, inside the pattern string, at which an error was found when checking the validity of the regular expression. If no error was found, then -1 is returned.
See also pattern(), isValid(), and errorString().
Upstream PySide2 reference signatures (binding differences may apply):
patternErrorOffset(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#patternErrorOffset
patternOptions
patternOptions() -> Any
X.patternOptions()
Supplemental documentation: Qt 5 reference:
QRegularExpression::PatternOptions QRegularExpression::patternOptions() const
Returns the pattern options for the regular expression.
See also setPatternOptions() and pattern().
Upstream PySide2 reference signatures (binding differences may apply):
patternOptions(self) -> PySide2.QtCore.QRegularExpression.PatternOptions
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#patternOptions
setPattern
setPattern(pattern: str) -> None
X.setPattern(pattern)
Supplemental documentation: Qt 5 reference:
void QRegularExpression::setPattern(const QString \&pattern)
Sets the pattern string of the regular expression to pattern. The pattern options are left unchanged.
See also pattern() and setPatternOptions().
Upstream PySide2 reference signatures (binding differences may apply):
setPattern(self, pattern: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#setPattern
setPatternOptions
setPatternOptions(options: Any) -> None
X.setPatternOptions(options)
Supplemental documentation: Qt 5 reference:
void QRegularExpression::setPatternOptions(QRegularExpression::PatternOptions options)
Sets the given options as the pattern options of the regular expression. The pattern string is left unchanged.
See also patternOptions() and setPattern().
Upstream PySide2 reference signatures (binding differences may apply):
setPatternOptions(self, options: PySide2.QtCore.QRegularExpression.PatternOptions) -> None
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#setPatternOptions
swap
swap(other: Any) -> None
X.swap(other)
Supplemental documentation: Qt 5 reference:
void QRegularExpression::swap(QRegularExpression \&other)
Swaps the regular expression other with this regular expression. This operation is very fast and never fails.
Upstream PySide2 reference signatures (binding differences may apply):
swap(self, other: PySide2.QtCore.QRegularExpression) -> None
Source: https://doc.qt.io/archives/qt-5.15/qregularexpression.html#swap