Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::RegularExpression Class Reference

The RegularExpression class is a collection of convenient regular expression statements.

#include <qx/core/qx-regularexpression.h>

Collaboration diagram for Qx::RegularExpression:
[legend]

Static Public Attributes

static const QRegularExpression ALPHANUMERIC_ONLY = QRegularExpression(u"^[a-zA-Z0-9]*$"_s, QRegularExpression::CaseInsensitiveOption)
 
static const QRegularExpression ANY_NON_HEX = QRegularExpression(u"[^a-fA-F0-9 -]"_s, QRegularExpression::CaseInsensitiveOption)
 
static const QRegularExpression HEX_ONLY = QRegularExpression(u"^[a-fA-F0-9]+$"_s, QRegularExpression::CaseInsensitiveOption)
 
static const QRegularExpression LETTERS_ONLY = QRegularExpression(u"^[a-zA-Z]+$"_s, QRegularExpression::CaseInsensitiveOption)
 
static const QRegularExpression LINE_BREAKS = QRegularExpression(u"[\\r\\n\\v]"_s)
 
static const QRegularExpression LONG_SEMANTIC_VERSION
 
static const QRegularExpression NUMBERS_ONLY = QRegularExpression(u"^[0-9]*$"_s, QRegularExpression::CaseInsensitiveOption)
 
static const QRegularExpression SEMANTIC_VERSION
 
static const QRegularExpression WHITESPACE = QRegularExpression(u"[\\f\\n\\r\\t\\v\x20\xA0\x00A0\u2028\u2029]"_s)
 

Member Data Documentation

◆ ALPHANUMERIC_ONLY

QRegularExpression Qx::RegularExpression::ALPHANUMERIC_ONLY = QRegularExpression(u"^[a-zA-Z0-9]*$"_s, QRegularExpression::CaseInsensitiveOption)
inlinestatic

Matches text that only contains Latin letters and numeric characters.

◆ ANY_NON_HEX

QRegularExpression Qx::RegularExpression::ANY_NON_HEX = QRegularExpression(u"[^a-fA-F0-9 -]"_s, QRegularExpression::CaseInsensitiveOption)
inlinestatic

Matches text that contains at least a single non-hexadecimal character.

◆ HEX_ONLY

QRegularExpression Qx::RegularExpression::HEX_ONLY = QRegularExpression(u"^[a-fA-F0-9]+$"_s, QRegularExpression::CaseInsensitiveOption)
inlinestatic

Matches text that only contains valid hexadecimal characters (case-insensitive).

◆ LETTERS_ONLY

QRegularExpression Qx::RegularExpression::LETTERS_ONLY = QRegularExpression(u"^[a-zA-Z]+$"_s, QRegularExpression::CaseInsensitiveOption)
inlinestatic

Matches text that only contains Latin letters.

◆ LINE_BREAKS

QRegularExpression Qx::RegularExpression::LINE_BREAKS = QRegularExpression(u"[\\r\\n\\v]"_s)
inlinestatic

Matches any line break character.

◆ LONG_SEMANTIC_VERSION

QRegularExpression Qx::RegularExpression::LONG_SEMANTIC_VERSION
inlinestatic
Initial value:
u"(?P<major>0|[1-9]\\d*)"_s
u"\\."_s
u"(?P<minor>0|[1-9]\\d*)"_s
u"\\."_s
u"(?P<patch>0|[1-9]\\d*)"_s
u"\\."_s
u"(?P<revision>0|[1-9]\\d*)"_s
u"(?:-(?P<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?"_s
u"(?:\\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"_s)

Same as SEMANTIC_VERSION except that 4 digits are expected instead of 3, with the fourth digit corresponding to the additional capture group 'revision'.

◆ NUMBERS_ONLY

QRegularExpression Qx::RegularExpression::NUMBERS_ONLY = QRegularExpression(u"^[0-9]*$"_s, QRegularExpression::CaseInsensitiveOption)
inlinestatic

Matches text that only contains numeric characters.

◆ SEMANTIC_VERSION

QRegularExpression Qx::RegularExpression::SEMANTIC_VERSION
inlinestatic
Initial value:
u"(?P<major>0|[1-9]\\d*)"_s
u"\\."_s
u"(?P<minor>0|[1-9]\\d*)"_s
u"\\."_s
u"(?P<patch>0|[1-9]\\d*)"_s
u"(?:-(?P<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?"_s
u"(?:\\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"_s)

Matches text that denotes a semantic version in accordance with the Semantic Version 2.0.0 specification.

The resulting match is valid for VersionNumber::fromString().

Provides the following capture groups:

  • major
  • minor
  • patch
  • prerelease
  • buildmetadata
Note
Unlike the officially recommended regular expression, this one does not use ^ or $ so that the semantic version section of a larger string may be matched.
See also
VersionNumber.

◆ WHITESPACE

QRegularExpression Qx::RegularExpression::WHITESPACE = QRegularExpression(u"[\\f\\n\\r\\t\\v\x20\xA0\x00A0\u2028\u2029]"_s)
inlinestatic

Matches any whitespace character. Specifically:

  • \f
  • \n
  • \r
  • \t
  • \v
  • \x20
  • \xA0
  • \u00A0
  • \u2028
  • \u2029

The documentation for this class was generated from the following files: