From d57731b0d7ac78c2adc9f7a58a52b3c782e15d20 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 30 Jan 2013 23:19:08 +0000 Subject: QRegularExpression: print a warning if (?J) is used in a pattern (?J) inside a pattern string can be used to allow or disallow duplicated capturing group names in the pattern string itself. Although PCRE supports duplicated names, in Qt we don't yet. Change-Id: I21cd0c41273cd7ef42870ced3a0fad6ba7035cbc Reviewed-by: Thiago Macieira --- src/corelib/tools/qregularexpression.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 706856c70b..9f29c1b576 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1013,6 +1013,14 @@ void QRegularExpressionPrivate::getPatternInfo() usingCrLfNewlines = (patternNewlineSetting == PCRE_NEWLINE_CRLF) || (patternNewlineSetting == PCRE_NEWLINE_ANY) || (patternNewlineSetting == PCRE_NEWLINE_ANYCRLF); + + int hasJOptionChanged; + pcre16_fullinfo(compiledPattern, 0, PCRE_INFO_JCHANGED, &hasJOptionChanged); + if (hasJOptionChanged) { + qWarning("QRegularExpressionPrivate::getPatternInfo(): the pattern '%s'\n" + " is using the (?J) option; duplicate capturing group names are not supported by Qt", + qPrintable(pattern)); + } } -- cgit v1.2.3