44 #include <QtCore/qcoreapplication.h>
45 #include <QtCore/qhashfunctions.h>
46 #include <QtCore/qlist.h>
47 #include <QtCore/qmutex.h>
48 #include <QtCore/qstringlist.h>
49 #include <QtCore/qdebug.h>
50 #include <QtCore/qthreadstorage.h>
51 #include <QtCore/qglobal.h>
52 #include <QtCore/qatomic.h>
53 #include <QtCore/qdatastream.h>
55 #if defined(Q_OS_MACOS)
56 #include <QtCore/private/qcore_mac_p.h>
59 #define PCRE2_CODE_UNIT_WIDTH 16
701 static int convertToPcreOptions(QRegularExpression::PatternOptions patternOptions)
726 static int convertToPcreOptions(QRegularExpression::MatchOptions matchOptions)
847 usingCrLfNewlines(
false),
871 patternOptions(
other.patternOptions),
878 usingCrLfNewlines(
false),
942 unsigned int patternNewlineSetting;
952 unsigned int hasJOptionChanged;
955 qWarning(
"QRegularExpressionPrivate::getPatternInfo(): the pattern '%ls'\n is using the (?J) option; duplicate capturing group names are not supported by Qt",
977 stack = pcre2_jit_stack_create_16(32 * 1024, 512 * 1024,
nullptr);
985 pcre2_jit_stack_free_16(
stack);
996 static pcre2_jit_stack_16 *qtPcreCallback(
void *)
998 if (jitStacks()->hasLocalData())
999 return jitStacks()->localData()->stack;
1007 static bool isJitEnabled()
1009 QByteArray jitEnvironment = qgetenv(
"QT_ENABLE_REGEXP_JIT");
1010 if (!jitEnvironment.
isEmpty()) {
1012 int enableJit = jitEnvironment.
toInt(&
ok);
1013 return ok ? (enableJit != 0) :
true;
1018 #elif defined(Q_OS_MACOS)
1019 return !qt_mac_runningUnderRosetta();
1038 static const bool enableJit = isJitEnabled();
1061 unsigned int namedCapturingTableEntryCount;
1062 unsigned int namedCapturingTableEntrySize;
1068 for (
unsigned int i = 0;
i < namedCapturingTableEntryCount; ++
i) {
1069 const auto currentNamedCapturingTableRow =
1070 reinterpret_cast<const char16_t *
>(namedCapturingTable) + namedCapturingTableEntrySize *
i;
1072 if (
name == (currentNamedCapturingTableRow + 1)) {
1073 const int index = *currentNamedCapturingTableRow;
1088 static int safe_pcre2_match_16(
const pcre2_code_16 *
code,
1091 pcre2_match_data_16 *matchData,
1092 pcre2_match_context_16 *matchContext)
1095 startOffset, options, matchData, matchContext);
1099 jitStacks()->setLocalData(
p);
1102 startOffset, options, matchData, matchContext);
1153 qWarning(
"QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object");
1163 int pcreOptions = convertToPcreOptions(priv->
matchOptions);
1173 bool previousMatchWasEmpty =
false;
1174 if (previous && previous->
hasMatch &&
1176 previousMatchWasEmpty =
true;
1179 pcre2_match_context_16 *matchContext = pcre2_match_context_create_16(
nullptr);
1180 pcre2_jit_stack_assign_16(matchContext, &qtPcreCallback,
nullptr);
1181 pcre2_match_data_16 *matchData = pcre2_match_data_create_from_pattern_16(
compiledPattern,
nullptr);
1187 const char16_t dummySubject = 0;
1188 const char16_t *
const subjectUtf16 = [&]()
1192 return subjectUtf16;
1194 return &dummySubject;
1199 if (!previousMatchWasEmpty) {
1201 reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
1203 matchData, matchContext);
1206 reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
1208 matchData, matchContext);
1214 &&
offset < subjectLength
1218 }
else if (
offset < subjectLength
1224 reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
1226 matchData, matchContext);
1230 #ifdef QREGULAREXPRESSION_DEBUG
1265 PCRE2_SIZE *ovector = pcre2_get_ovector_pointer_16(matchData);
1289 unsigned int maximumLookBehind;
1291 capturedOffsets[0] -= maximumLookBehind;
1295 pcre2_match_data_free_16(matchData);
1296 pcre2_match_context_free_16(matchContext);
1303 const QString &subjectStorage,
1306 QRegularExpression::MatchOptions matchOptions)
1307 : regularExpression(re),
1308 subjectStorage(subjectStorage),
1310 matchType(matchType),
1311 matchOptions(matchOptions)
1345 QRegularExpression::MatchOptions matchOptions,
1348 regularExpression(re),
1349 matchType(matchType), matchOptions(matchOptions)
1538 unsigned int namedCapturingTableEntryCount;
1539 unsigned int namedCapturingTableEntrySize;
1548 for (
unsigned int i = 0;
i < namedCapturingTableEntryCount; ++
i) {
1549 const auto currentNamedCapturingTableRow =
1550 reinterpret_cast<const char16_t *
>(namedCapturingTable) + namedCapturingTableEntrySize *
i;
1552 const int index = *currentNamedCapturingTableRow;
1583 int errorStringLength;
1586 errorStringLength = pcre2_get_error_message_16(d->
errorCode,
1589 }
while (errorStringLength < 0);
1592 #ifdef QT_NO_TRANSLATION
1598 #ifdef QT_NO_TRANSLATION
1636 MatchOptions matchOptions)
const
1667 MatchOptions matchOptions)
const
1698 MatchOptions matchOptions)
const
1730 MatchOptions matchOptions)
const
1736 match(subjectView,
offset, matchType, matchOptions));
1763 return (d == re.d) ||
1935 rx.reserve(wclen + wclen / 16);
1951 switch (
c.unicode()) {
1956 rx += questionMarkEscape;
1992 if (wc[
i] ==
QLatin1Char(
'/') || wc[
i] == nativePathSeparator)
2026 WildcardConversionOptions options)
2323 if (
name.isEmpty()) {
2324 qWarning(
"QRegularExpressionMatch::captured: empty capturing group name passed");
2345 if (
name.isEmpty()) {
2346 qWarning(
"QRegularExpressionMatch::capturedView: empty capturing group name passed");
2458 if (
name.isEmpty()) {
2459 qWarning(
"QRegularExpressionMatch::capturedStart: empty capturing group name passed");
2481 if (
name.isEmpty()) {
2482 qWarning(
"QRegularExpressionMatch::capturedLength: empty capturing group name passed");
2503 if (
name.isEmpty()) {
2504 qWarning(
"QRegularExpressionMatch::capturedEnd: empty capturing group name passed");
2674 qWarning(
"QRegularExpressionMatchIterator::peekNext() called on an iterator already at end");
2688 qWarning(
"QRegularExpressionMatchIterator::next() called on an iterator already at end");
2744 #ifndef QT_NO_DATASTREAM
2771 re.
setPatternOptions(QRegularExpression::PatternOptions::fromInt(patternOptions));
2776 #ifndef QT_NO_DEBUG_STREAM
2806 flags =
"NoPatternOption";
2810 flags.append(
"CaseInsensitiveOption|");
2812 flags.append(
"DotMatchesEverythingOption|");
2814 flags.append(
"MultilineOption|");
2816 flags.append(
"ExtendedPatternSyntaxOption|");
2818 flags.append(
"InvertedGreedinessOption|");
2820 flags.append(
"DontCaptureOption|");
2822 flags.append(
"UseUnicodePropertiesOption|");
2826 debug.nospace() <<
"QRegularExpression::PatternOptions(" <<
flags <<
')';
2841 debug.nospace() <<
"QRegularExpressionMatch(";
2844 debug <<
"Invalid)";
2851 debug <<
", has match: ";
2860 debug <<
", has partial match: ("
2865 debug <<
", no match";
2914 static const char *pcreCompileErrorCodes[] =
2916 QT_TRANSLATE_NOOP(
"QRegularExpression",
"no error"),
2917 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\ at end of pattern"),
2918 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\c at end of pattern"),
2919 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unrecognized character follows \\"),
2920 QT_TRANSLATE_NOOP(
"QRegularExpression",
"numbers out of order in {} quantifier"),
2921 QT_TRANSLATE_NOOP(
"QRegularExpression",
"number too big in {} quantifier"),
2922 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing terminating ] for character class"),
2923 QT_TRANSLATE_NOOP(
"QRegularExpression",
"escape sequence is invalid in character class"),
2924 QT_TRANSLATE_NOOP(
"QRegularExpression",
"range out of order in character class"),
2925 QT_TRANSLATE_NOOP(
"QRegularExpression",
"quantifier does not follow a repeatable item"),
2926 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: unexpected repeat"),
2927 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unrecognized character after (? or (?-"),
2928 QT_TRANSLATE_NOOP(
"QRegularExpression",
"POSIX named classes are supported only within a class"),
2929 QT_TRANSLATE_NOOP(
"QRegularExpression",
"POSIX collating elements are not supported"),
2930 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing closing parenthesis"),
2931 QT_TRANSLATE_NOOP(
"QRegularExpression",
"reference to non-existent subpattern"),
2932 QT_TRANSLATE_NOOP(
"QRegularExpression",
"pattern passed as NULL"),
2933 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unrecognised compile-time option bit(s)"),
2934 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing ) after (?# comment"),
2935 QT_TRANSLATE_NOOP(
"QRegularExpression",
"parentheses are too deeply nested"),
2936 QT_TRANSLATE_NOOP(
"QRegularExpression",
"regular expression is too large"),
2937 QT_TRANSLATE_NOOP(
"QRegularExpression",
"failed to allocate heap memory"),
2938 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unmatched closing parenthesis"),
2939 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: code overflow"),
2940 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing closing parenthesis for condition"),
2941 QT_TRANSLATE_NOOP(
"QRegularExpression",
"lookbehind assertion is not fixed length"),
2942 QT_TRANSLATE_NOOP(
"QRegularExpression",
"a relative value of zero is not allowed"),
2943 QT_TRANSLATE_NOOP(
"QRegularExpression",
"conditional subpattern contains more than two branches"),
2944 QT_TRANSLATE_NOOP(
"QRegularExpression",
"assertion expected after (?( or (?(?C)"),
2945 QT_TRANSLATE_NOOP(
"QRegularExpression",
"digit expected after (?+ or (?-"),
2946 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unknown POSIX class name"),
2947 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error in pcre2_study(): should not occur"),
2948 QT_TRANSLATE_NOOP(
"QRegularExpression",
"this version of PCRE2 does not have Unicode support"),
2949 QT_TRANSLATE_NOOP(
"QRegularExpression",
"parentheses are too deeply nested (stack check)"),
2950 QT_TRANSLATE_NOOP(
"QRegularExpression",
"character code point value in \\x{} or \\o{} is too large"),
2951 QT_TRANSLATE_NOOP(
"QRegularExpression",
"lookbehind is too complicated"),
2952 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\C is not allowed in a lookbehind assertion in UTF-" "16" " mode"),
2953 QT_TRANSLATE_NOOP(
"QRegularExpression",
"PCRE2 does not support \\F, \\L, \\l, \\N{name}, \\U, or \\u"),
2954 QT_TRANSLATE_NOOP(
"QRegularExpression",
"number after (?C is greater than 255"),
2955 QT_TRANSLATE_NOOP(
"QRegularExpression",
"closing parenthesis for (?C expected"),
2956 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid escape sequence in (*VERB) name"),
2957 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unrecognized character after (?P"),
2958 QT_TRANSLATE_NOOP(
"QRegularExpression",
"syntax error in subpattern name (missing terminator?)"),
2959 QT_TRANSLATE_NOOP(
"QRegularExpression",
"two named subpatterns have the same name (PCRE2_DUPNAMES not set)"),
2960 QT_TRANSLATE_NOOP(
"QRegularExpression",
"subpattern name must start with a non-digit"),
2961 QT_TRANSLATE_NOOP(
"QRegularExpression",
"this version of PCRE2 does not have support for \\P, \\p, or \\X"),
2962 QT_TRANSLATE_NOOP(
"QRegularExpression",
"malformed \\P or \\p sequence"),
2963 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unknown property name after \\P or \\p"),
2964 QT_TRANSLATE_NOOP(
"QRegularExpression",
"subpattern name is too long (maximum " "32" " code units)"),
2965 QT_TRANSLATE_NOOP(
"QRegularExpression",
"too many named subpatterns (maximum " "10000" ")"),
2966 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid range in character class"),
2967 QT_TRANSLATE_NOOP(
"QRegularExpression",
"octal value is greater than \\377 in 8-bit non-UTF-8 mode"),
2968 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: overran compiling workspace"),
2969 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: previously-checked referenced subpattern not found"),
2970 QT_TRANSLATE_NOOP(
"QRegularExpression",
"DEFINE subpattern contains more than one branch"),
2971 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing opening brace after \\o"),
2972 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: unknown newline setting"),
2973 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number"),
2974 QT_TRANSLATE_NOOP(
"QRegularExpression",
"(?R (recursive pattern call) must be followed by a closing parenthesis"),
2975 QT_TRANSLATE_NOOP(
"QRegularExpression",
"obsolete error (should not occur)"),
2976 QT_TRANSLATE_NOOP(
"QRegularExpression",
"(*VERB) not recognized or malformed"),
2977 QT_TRANSLATE_NOOP(
"QRegularExpression",
"subpattern number is too big"),
2978 QT_TRANSLATE_NOOP(
"QRegularExpression",
"subpattern name expected"),
2979 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: parsed pattern overflow"),
2980 QT_TRANSLATE_NOOP(
"QRegularExpression",
"non-octal character in \\o{} (closing brace missing?)"),
2981 QT_TRANSLATE_NOOP(
"QRegularExpression",
"different names for subpatterns of the same number are not allowed"),
2982 QT_TRANSLATE_NOOP(
"QRegularExpression",
"(*MARK) must have an argument"),
2983 QT_TRANSLATE_NOOP(
"QRegularExpression",
"non-hex character in \\x{} (closing brace missing?)"),
2984 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\c must be followed by a printable ASCII character"),
2985 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\c must be followed by a letter or one of [\\]^_?"),
2986 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\k is not followed by a braced, angle-bracketed, or quoted name"),
2987 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: unknown meta code in check_lookbehinds()"),
2988 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\N is not supported in a class"),
2989 QT_TRANSLATE_NOOP(
"QRegularExpression",
"callout string is too long"),
2990 QT_TRANSLATE_NOOP(
"QRegularExpression",
"disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"),
2991 QT_TRANSLATE_NOOP(
"QRegularExpression",
"using UTF is disabled by the application"),
2992 QT_TRANSLATE_NOOP(
"QRegularExpression",
"using UCP is disabled by the application"),
2993 QT_TRANSLATE_NOOP(
"QRegularExpression",
"name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"),
2994 QT_TRANSLATE_NOOP(
"QRegularExpression",
"character code point value in \\u.... sequence is too large"),
2995 QT_TRANSLATE_NOOP(
"QRegularExpression",
"digits missing in \\x{} or \\o{} or \\N{U+}"),
2996 QT_TRANSLATE_NOOP(
"QRegularExpression",
"syntax error or number too big in (?(VERSION condition"),
2997 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: unknown opcode in auto_possessify()"),
2998 QT_TRANSLATE_NOOP(
"QRegularExpression",
"missing terminating delimiter for callout with string argument"),
2999 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unrecognized string delimiter follows (?C"),
3000 QT_TRANSLATE_NOOP(
"QRegularExpression",
"using \\C is disabled by the application"),
3001 QT_TRANSLATE_NOOP(
"QRegularExpression",
"(?| and/or (?J: or (?x: parentheses are too deeply nested"),
3002 QT_TRANSLATE_NOOP(
"QRegularExpression",
"using \\C is disabled in this PCRE2 library"),
3003 QT_TRANSLATE_NOOP(
"QRegularExpression",
"regular expression is too complicated"),
3004 QT_TRANSLATE_NOOP(
"QRegularExpression",
"lookbehind assertion is too long"),
3005 QT_TRANSLATE_NOOP(
"QRegularExpression",
"pattern string is longer than the limit set by the application"),
3006 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: unknown code in parsed pattern"),
3007 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error: bad code value in parsed_skip()"),
3008 QT_TRANSLATE_NOOP(
"QRegularExpression",
"PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode"),
3009 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid option bits with PCRE2_LITERAL"),
3010 QT_TRANSLATE_NOOP(
"QRegularExpression",
"\\N{U+dddd} is supported only in Unicode (UTF) mode"),
3011 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid hyphen in option setting"),
3012 QT_TRANSLATE_NOOP(
"QRegularExpression",
"(*alpha_assertion) not recognized"),
3013 QT_TRANSLATE_NOOP(
"QRegularExpression",
"script runs require Unicode support, which this version of PCRE2 does not have"),
3014 QT_TRANSLATE_NOOP(
"QRegularExpression",
"too many capturing groups (maximum 65535)"),
3015 QT_TRANSLATE_NOOP(
"QRegularExpression",
"atomic assertion expected after (?( or (?(?C)"),
3016 QT_TRANSLATE_NOOP(
"QRegularExpression",
"no error"),
3017 QT_TRANSLATE_NOOP(
"QRegularExpression",
"no match"),
3018 QT_TRANSLATE_NOOP(
"QRegularExpression",
"partial match"),
3019 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 1 byte missing at end"),
3020 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 2 bytes missing at end"),
3021 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 3 bytes missing at end"),
3022 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 4 bytes missing at end"),
3023 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 5 bytes missing at end"),
3024 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: byte 2 top bits not 0x80"),
3025 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: byte 3 top bits not 0x80"),
3026 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: byte 4 top bits not 0x80"),
3027 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: byte 5 top bits not 0x80"),
3028 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: byte 6 top bits not 0x80"),
3029 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 5-byte character is not allowed (RFC 3629)"),
3030 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: 6-byte character is not allowed (RFC 3629)"),
3031 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: code points greater than 0x10ffff are not defined"),
3032 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: code points 0xd800-0xdfff are not defined"),
3033 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: overlong 2-byte sequence"),
3034 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: overlong 3-byte sequence"),
3035 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: overlong 4-byte sequence"),
3036 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: overlong 5-byte sequence"),
3037 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: overlong 6-byte sequence"),
3038 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: isolated byte with 0x80 bit set"),
3039 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-8 error: illegal byte (0xfe or 0xff)"),
3040 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-16 error: missing low surrogate at end"),
3041 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-16 error: invalid low surrogate"),
3042 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-16 error: isolated low surrogate"),
3043 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-32 error: code points 0xd800-0xdfff are not defined"),
3044 QT_TRANSLATE_NOOP(
"QRegularExpression",
"UTF-32 error: code points greater than 0x10ffff are not defined"),
3045 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad data value"),
3046 QT_TRANSLATE_NOOP(
"QRegularExpression",
"patterns do not all use the same character tables"),
3047 QT_TRANSLATE_NOOP(
"QRegularExpression",
"magic number missing"),
3048 QT_TRANSLATE_NOOP(
"QRegularExpression",
"pattern compiled in wrong mode: 8/16/32-bit error"),
3049 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad offset value"),
3050 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad option value"),
3051 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid replacement string"),
3052 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad offset into UTF string"),
3053 QT_TRANSLATE_NOOP(
"QRegularExpression",
"callout error code"),
3054 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid data in workspace for DFA restart"),
3055 QT_TRANSLATE_NOOP(
"QRegularExpression",
"too much recursion for DFA matching"),
3056 QT_TRANSLATE_NOOP(
"QRegularExpression",
"backreference condition or recursion test is not supported for DFA matching"),
3057 QT_TRANSLATE_NOOP(
"QRegularExpression",
"function is not supported for DFA matching"),
3058 QT_TRANSLATE_NOOP(
"QRegularExpression",
"pattern contains an item that is not supported for DFA matching"),
3059 QT_TRANSLATE_NOOP(
"QRegularExpression",
"workspace size exceeded in DFA matching"),
3060 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error - pattern overwritten?"),
3061 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad JIT option"),
3062 QT_TRANSLATE_NOOP(
"QRegularExpression",
"JIT stack limit reached"),
3063 QT_TRANSLATE_NOOP(
"QRegularExpression",
"match limit exceeded"),
3064 QT_TRANSLATE_NOOP(
"QRegularExpression",
"no more memory"),
3065 QT_TRANSLATE_NOOP(
"QRegularExpression",
"unknown substring"),
3066 QT_TRANSLATE_NOOP(
"QRegularExpression",
"non-unique substring name"),
3067 QT_TRANSLATE_NOOP(
"QRegularExpression",
"NULL argument passed"),
3068 QT_TRANSLATE_NOOP(
"QRegularExpression",
"nested recursion at the same subject position"),
3069 QT_TRANSLATE_NOOP(
"QRegularExpression",
"matching depth limit exceeded"),
3070 QT_TRANSLATE_NOOP(
"QRegularExpression",
"requested value is not available"),
3071 QT_TRANSLATE_NOOP(
"QRegularExpression",
"requested value is not set"),
3072 QT_TRANSLATE_NOOP(
"QRegularExpression",
"offset limit set without PCRE2_USE_OFFSET_LIMIT"),
3073 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad escape sequence in replacement string"),
3074 QT_TRANSLATE_NOOP(
"QRegularExpression",
"expected closing curly bracket in replacement string"),
3075 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad substitution in replacement string"),
3076 QT_TRANSLATE_NOOP(
"QRegularExpression",
"match with end before start or start moved backwards is not supported"),
3077 QT_TRANSLATE_NOOP(
"QRegularExpression",
"too many replacements (more than INT_MAX)"),
3078 QT_TRANSLATE_NOOP(
"QRegularExpression",
"bad serialized data"),
3079 QT_TRANSLATE_NOOP(
"QRegularExpression",
"heap limit exceeded"),
3080 QT_TRANSLATE_NOOP(
"QRegularExpression",
"invalid syntax"),
3081 QT_TRANSLATE_NOOP(
"QRegularExpression",
"internal error - duplicate substitution match"),
3082 QT_TRANSLATE_NOOP(
"QRegularExpression",
"PCRE2_MATCH_INVALID_UTF is not supported for DFA matching")
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
int toInt(bool *ok=nullptr, int base=10) const
bool isEmpty() const noexcept
The QChar class provides a 16-bit Unicode character.
constexpr bool isLowSurrogate() const noexcept
constexpr bool isHighSurrogate() const noexcept
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
The QDataStream class provides serialization of binary data to a QIODevice.
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
T * data() const noexcept
const T * constData() const noexcept
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
template< typename... T > size_t qHashMulti(size_t seed, const T &...args)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
const_reference at(qsizetype i) const noexcept
void resize(qsizetype size)
The QMutex class provides access serialization between threads.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes.
pcre2_jit_stack_16 * stack
The QRegularExpression class provides pattern matching using regular expressions.
@ AnchorAtOffsetMatchOption
@ DontCheckSubjectStringMatchOption
PatternOptions patternOptions() const
friend class QRegularExpressionMatch
void setPatternOptions(PatternOptions options)
QDataStream & operator<<(QDataStream &out, const QRegularExpression &re)
qsizetype patternErrorOffset() const
static QString escape(const QString &str)
QDataStream & operator>>(QDataStream &in, QRegularExpression &re)
static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs=Qt::CaseInsensitive, WildcardConversionOptions options=DefaultWildcardConversion)
void setPattern(const QString &pattern)
QStringList namedCaptureGroups() const
@ ExtendedPatternSyntaxOption
@ InvertedGreedinessOption
@ UseUnicodePropertiesOption
@ DotMatchesEverythingOption
friend struct QRegularExpressionMatchPrivate
@ PartialPreferCompleteMatch
@ PartialPreferFirstMatch
friend class QRegularExpressionMatchIterator
bool operator==(const QRegularExpression &re) const
QRegularExpressionMatch match(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions)
QString errorString() const
QRegularExpressionMatchIterator globalMatch(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
static QString anchoredPattern(const QString &expression)
static QString wildcardToRegularExpression(const QString &str, WildcardConversionOptions options=DefaultWildcardConversion)
@ UnanchoredWildcardConversion
QDebug operator<<(QDebug debug, const QRegularExpression &re)
The QRegularExpressionMatch class provides the results of a matching a QRegularExpression against a s...
QRegularExpression::MatchOptions matchOptions() const
QRegularExpressionMatch()
QStringView capturedView(int nth=0) const
qsizetype capturedEnd(int nth=0) const
QRegularExpression::MatchType matchType() const
~QRegularExpressionMatch()
bool hasPartialMatch() const
bool hasCaptured(const QString &name) const
QStringList capturedTexts() const
qsizetype capturedStart(int nth=0) const
qsizetype capturedLength(int nth=0) const
int lastCapturedIndex() const
QRegularExpressionMatch & operator=(const QRegularExpressionMatch &match)
QString captured(int nth=0) const
QRegularExpression regularExpression() const
QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match)
The QRegularExpressionMatchIterator class provides an iterator on the results of a global match of a ...
QRegularExpressionMatch next()
QRegularExpressionMatchIterator & operator=(const QRegularExpressionMatchIterator &iterator)
~QRegularExpressionMatchIterator()
QRegularExpressionMatchIterator()
QRegularExpression::MatchOptions matchOptions() const
QRegularExpressionMatch peekNext() const
QRegularExpression::MatchType matchType() const
QRegularExpression regularExpression() const
The QSharedData class is a base class for shared data objects. \reentrant.
The QString class provides a Unicode character string.
static QString fromUtf16(const char16_t *, qsizetype size=-1)
const QChar at(qsizetype i) const
void resize(qsizetype size)
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
constexpr const storage_type * utf16() const noexcept
constexpr qsizetype size() const noexcept
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
The QThreadStorage class provides per-thread data storage.
auto it unsigned count const
typename C::iterator iterator
#define PCRE2_INFO_CAPTURECOUNT
#define PCRE2_NOTEMPTY_ATSTART
#define PCRE2_CONFIG_NEWLINE
#define PCRE2_INFO_NAMETABLE
#define PCRE2_ERROR_NOMATCH
#define PCRE2_INFO_JCHANGED
#define PCRE2_NEWLINE_ANYCRLF
#define PCRE2_PARTIAL_SOFT
#define PCRE2_PARTIAL_HARD
#define PCRE2_ERROR_JIT_STACKLIMIT
#define PCRE2_INFO_MAXLOOKBEHIND
const PCRE2_UCHAR16 * PCRE2_SPTR16
#define PCRE2_INFO_NEWLINE
#define PCRE2_JIT_PARTIAL_HARD
#define PCRE2_JIT_COMPLETE
#define PCRE2_INFO_NAMECOUNT
#define PCRE2_NEWLINE_CRLF
#define PCRE2_NO_AUTO_CAPTURE
#define PCRE2_JIT_PARTIAL_SOFT
#define PCRE2_NO_UTF_CHECK
#define PCRE2_ERROR_PARTIAL
#define PCRE2_NEWLINE_ANY
#define PCRE2_INFO_NAMEENTRYSIZE
QList< QString > QStringList
#define Q_DISABLE_COPY(Class)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
QTextStream out(stdout)
[7]
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRegularExpressionMatch next
QRegularExpressionMatchIteratorPrivate(const QRegularExpression &re, QRegularExpression::MatchType matchType, QRegularExpression::MatchOptions matchOptions, const QRegularExpressionMatch &next)
const QRegularExpression regularExpression
const QRegularExpression::MatchOptions matchOptions
const QRegularExpression::MatchType matchType
QList< qsizetype > capturedOffsets
QRegularExpressionMatchPrivate(const QRegularExpression &re, const QString &subjectStorage, QStringView subject, QRegularExpression::MatchType matchType, QRegularExpression::MatchOptions matchOptions)
const QRegularExpression::MatchType matchType
const QRegularExpression::MatchOptions matchOptions
const QString subjectStorage
QRegularExpressionMatch nextMatch() const
const QRegularExpression regularExpression
const QStringView subject
int captureIndexForName(QStringView name) const
void doMatch(QRegularExpressionMatchPrivate *priv, qsizetype offset, CheckSubjectStringOption checkSubjectStringOption=CheckSubjectString, const QRegularExpressionMatchPrivate *previous=nullptr) const
void cleanCompiledPattern()
QRegularExpressionPrivate()
pcre2_code_16 * compiledPattern
~QRegularExpressionPrivate()
QRegularExpression::PatternOptions patternOptions