summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qregularexpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-9/+26
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Doc: Clarify the porting notes from QRegExp to QRegularExpressionFriedemann Kleint2017-04-071-9/+26
| | | | | | | | | | | | | | | | | | | | Add a small table to illustrate the results exactMatch() and split out the part on partial matching to a separate section since it is less common. Change-Id: Ifbd5c3cbd1d8c0ee9e8b2d58ed13f40776b03762 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Use qToStringViewIgnoringNull() where applicableMarc Mutz2017-04-191-5/+5
| | | | | | | | | | | | | | | | | | Saves just over ¼KiB in QtCore text size on optimized GCC 6.1 Linux AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use. Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QRegularExpression: streamline some wording in the documentationGiuseppe D'Angelo2017-04-111-19/+30
| | | | | | | | | | | | Change-Id: Ic1adbf9358ef6fbdaaee52471cd8ed9ca895a9d0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devLiang Qi2017-04-041-1/+1
|\|
| * Prefer rvalue versions of toLatin() and toUtf8()Anton Kudryavtsev2017-03-301-1/+1
| | | | | | | | | | | | | | ... to re-use existing buffers. Change-Id: I7c42529b8cd4400520a59e658ab76f4f8e965cd4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpressionMatch: add QStringView-related functionsGiuseppe D'Angelo2017-04-041-12/+129
|/ | | | | Change-Id: Ia81ba131cc2c7f56acb3312fbc7d62ffe5e18da4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QRegularExpression: build fixGiuseppe D'Angelo2017-03-021-0/+2
| | | | | | | | | Latest PCRE2 versions require a macro to be defined before including pcre2.h, so do it. Task-number: QTBUG-59226 Change-Id: I472ff557e29d1212fdcd99454778551323be4d4b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* PCRE2: port QRegularExpression to PCRE2Giuseppe D'Angelo2016-12-121-233/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCRE1 is going towards EOL. PCRE2 is the way forward in terms of new features, performance, and security improvements. The APIs that QRegularExpression uses are similar so the required modifications aren't extensive. The biggest difference comes to JIT-compiling of the pattern. In PCRE1, JIT-compiling did not modify the processed PCRE pattern, but returned a new chunk of data. This allowed multiple threads to keep matching using the same processed data and NULL for the JIT data, until a thread JIT-compiled and atomically set the shared JIT data to the results of the compilation. In PCRE2, JIT-compiling _modifies_ the processed PCRE pattern in a way that it's thread unsafe [1]; the results of JIT-compilation are stored somewhere inside the processed pattern. This means the above approach cannot work -- a thread may be matching while another one JIT-compiles, causing a data race. While waiting for better workarounds from upstream, employ a read/write mutex to protect the matching from JIT-compilation. [1] https://lists.exim.org/lurker/message/20160104.105831.3cb25b39.en.html [ChangeLog][General] QRegularExpression now requires the PCRE2 library, at least version 10.20. Support for the PCRE1 library has been dropped. A copy of PCRE2 is shipped with Qt and will automatically be used on those platforms which lack it. Change-Id: I9fe11104230a096796df2d0bdcea861acf769f57 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-221-1/+1
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/qeglfshooks.cpp Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
| * Fix some typos in docs and apidocsFrederik Schwarzer2016-10-211-1/+1
| | | | | | | | | | | | | | | | While "commonest" is still correct English, it's rather old-fashioned and "most common" predominates Qt's wording style. Change-Id: I20d72c098ee40b2a89f91e42f7208fe5b87286a2 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-5/+5
| | | | | | | Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-08-261-24/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/snippets/code/doc_src_qmake-manual.pro qmake/doc/src/qmake-manual.qdoc src/corelib/io/qstorageinfo_unix.cpp src/corelib/tools/qbytearray.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp tests/auto/network/access/qnetworkreply/BLACKLIST Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
| * QRegularExpression: fix matching over QStringRefsGiuseppe D'Angelo2015-08-181-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing with the offset argument of pcre_exec is not equivalent to adjusting the pointer to the subject string. In particular, PCRE can go behind the offset to check for lookbehinds or "transition" metacharacters (\b, \B, etc.). This made the code that deals with QStringRefs not matching in behavior with the corresponding code dealing with QStrings. For instance, QString subject("Miss"); QRegularExpression re("(?<=M)iss"); re.match(subject.mid(1)); // doesn't match re.match(subject.midRef(1)); // matches!!! Instead, actually adjust the pointer to the subject string so that the behavior is identical. A broken test that relied on the equivalence is also removed. Change-Id: If96333241ef59621d7f5a6a170ebd0a186844874 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | core: Add several QList::reserve() calls.Sérgio Martins2015-06-111-1/+2
| | | | | | | | | | | | | | Reduces reallocations. Change-Id: Ib63539fb690a80245d8fe81ff8468e79ffa8e57c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-031-0/+20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qnamespace.qdoc src/corelib/io/qwindowspipereader.cpp src/corelib/io/qwindowspipereader_p.h src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/plugins/platforms/xcb/qxcbconnection.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/tools/qmake/tst_qmake.cpp tests/manual/touch/main.cpp Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
| * Doc: added doc to undocumented functionsNico Vertriest2015-05-181-0/+20
| | | | | | | | | | | | | | Task-number: QTBUG-36985 Change-Id: Ia98654f88cf5da77245b3fcd903b860d12862fc2 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Add qHash(QRegExp) and qHash(QRegularExpression)Marc Mutz2015-05-051-0/+16
|/ | | | | | | | | | | | | | | | QReg*Exp*s can be compared for equality, so qHash should be overloaded, too. There was a (poor) private implementation of qHash(QRegExpEngineKey) already, which has now been replaced with a better one (the old one didn't take into account all the fields that make up equality, producing unnecessary collisions). [ChangeLog][QtCore][QRegExp] Added qHash(QRegExp). [ChangeLog][QtCore][QRegularExpression] Added qHash(QRegularExpression). Change-Id: I1d22fbcc0508018a3f94b4c24571b13ba6e07df2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QRegularExpression: add error strings from PCRE 8.37Giuseppe D'Angelo2015-05-011-1/+2
| | | | | | | Change-Id: Id62abd91c1584e4e63b95afec0520995125fe807 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-4/+7
| | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-091-9/+9
|\ | | | | | | Change-Id: I05fcd8dc66d9ad0dc76bb7f5bae05c9876bfba14
| * Doc: Use title case in section1 titlesNico Vertriest2014-09-301-9/+9
| | | | | | | | | | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+15
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-0/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Fix QT_NO_REGULAREXPRESSION buildSérgio Martins2014-08-131-0/+4
| | | | | | | | | | | | | | | Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QRegularExpression: add overloads matching over a QStringRefGiuseppe D'Angelo2014-09-021-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QRegularExpression] Support for matching using QStringRef as the subject's string type has been added. Change-Id: Idb956bbbdf4213f9ebe035db32cd37cf3370c6bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QRegularExpression: take into account the subject's start position and offsetGiuseppe D'Angelo2014-09-021-24/+53
|/ / | | | | | | | | | | | | This will enable the matching over QStringRefs. Change-Id: I77729433d201982659a8c2aab939b2d15f1c8aca Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-071-0/+1
| | | | | | | | | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: make optimize() constGiuseppe D'Angelo2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Although it may seem strange that such a method is const, optimizing doesn't affect the user-visible part of the object. Moreover, *not* having it const makes it asymmetrical with other methods (such as match()) which are const, and under certain conditions optimize as well. Change-Id: I0cd8d4a6909d00629fcc65c1c3a1f011f31db782 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Revert "QRegularExpression: lock a mutex only if there's actual work to do"Giuseppe D'Angelo2014-07-131-2/+2
| | | | | | | | | | | | | | | | | | | | Blunder -- two threads may step into this method together, both see not studied, and both study (with one leaking its study data). This reverts commit 5fbd787cf9a72621d66604a4898f06ea4365226e. Change-Id: Ia746925abcad1e43adf4f6f1d495b018de022b07 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QRegularExpression: allow users to skip the UTF-16 check of the subject stringGiuseppe D'Angelo2014-05-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCRE does not handle invalid UTF-16 sequences. For this reason we always check a subject string's UTF-16 validity before attempting any match over it (actually we let PCRE do that). The only exception so far has been global matching -- once the first match was done, we skipped re-doing the check over and over again the same string (PCRE actually checks the /entire/ string, not only the part it uses for matching). Still, users had no way to skip this check if they were 100% sure the string was a valid UTF-16 string. This commit introduces a way for them to skip the check. Change-Id: Iea352c06f531aa2153863b3a1681acaab7ac375c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: remove a boolean trap in private APIGiuseppe D'Angelo2014-05-061-6/+12
| | | | | | | | | | | | | | Small improvement to the code by using an enum instead of a boolean. Change-Id: Ib792cf97224b5204fd36ca215387fc7be34f2c32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: lock a mutex only if there's actual work to doGiuseppe D'Angelo2014-05-061-2/+2
| | | | | | | | | | | | | | | | | | We can do the (atomic) test of studyData before locking the mutex protecting the entire function body. Change-Id: I3006e3a0028608f21668ddaebe8a799aed56362f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: add an option to prevent automatic optimizationGiuseppe D'Angelo2014-05-061-7/+25
| | | | | | | | | | | | | | | | | | | | If a user doesn't like that QRegularExpression might do an uncontrolled CPU/memory spike when it decides to optimize a pattern, offer a way to disable the automatic optimization. Change-Id: I38a98a3bfb239cfad9f977b0eeb75903268e747f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: add ways to force an immediate optimizationGiuseppe D'Angelo2014-05-061-4/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fact that we kick in a pattern study and possibly a JIT compilation after an undocumented number of usages is suboptimal, for a number or reasons: users may want to JIT compile a pattern immediately, and at the same time they may not want a random delay in the program (due to the pattern getting optimized at a random usage). So: add an optimize() call to force an immediate pattern optimization, and a pattern option to force an optimization on the first usage. Change-Id: I95efdecfd31f11ca7cceb9c05037df613601a11c Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: update the error strings to the ones in PCRE 8.35Giuseppe D'Angelo2014-04-281-1/+10
| | | | | | | | | | Change-Id: Iee03fff5971712c3eb51a32d632cb1a6c276699c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QRegularExpression: enable JIT study for partial matching tooGiuseppe D'Angelo2014-04-281-1/+1
|/ | | | | | | Task-number: QTBUG-38034 Change-Id: I0edc1c0b5e3be5fd12a91007b68e5eff7ccc7e40 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Repack structs with more than one padding holeThiago Macieira2013-12-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Sizes gained (measured on 64-bit systems) BezierEase: shrunk 8 bytes QRegExpCharClass: shrunk 8 bytes QRegularExpressionPrivate: shrunk 8 bytes QTimeLinePrivate: shrunk 8 bytes QUtcTimeZonePrivate: shrunk 8 bytes QTextStreamPrivate: shrunk 8 bytes QDirPrivate: shrunk 8 bytes QFileDevicePrivate: shrunk 8 bytes Not done: QRegExpEngine: 18 bytes in 6 holes (you deserve high memory usage if you're still using QRegExp) QTextBoundaryFinder: 8 bytes in 2 holes (public class) QIODevicePrivate: 6 bytes in 2 holes, but there's no gain in packing QProcessPrivate: too complex and my copy is modified QThreadData: awaiting change from Marc Change-Id: I2a388b5ce17dec0dafcef18ed2e80d0379aa7d1e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-11/+11
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Q_DISABLE_COPY doesn't need a ; at the endAlbert Astals Cid2013-06-101-1/+1
| | | | | | | | | Fixes warnings when -Wpedantic is enabled Change-Id: I8fcfbfa9bb3a5ab61c85f8cb74660f6f7e459fc0 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Alejandro Exojo Piqueras <suy@badopi.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QRegularExpression: refactor the handling of the study dataGiuseppe D'Angelo2013-03-121-17/+24
| | | | | | | | | | | | | | | | | | | | Consider the following situation: - threads A and B have shallow copies of the same QRegularExpression - threads A and B both call match() on a string - thread A calls optimizePattern(), which doesn't optimize - thread B calls optimizePattern(), which does optimize, and sets studyData - thread A uses studyData (set by B) A needs to properly acquire the memory pointed by studyData (which, in turn, needs to be released by B). This commit implements that. (Before, we used to return a copy of the current studyData from optimizePattern(), so A didn't see that B optimized the pattern and set studyData). Change-Id: I9e4741a3d3229905c247491a07099519815680bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve QRegularExpression captureCount / namedCaptureGroups docsGiuseppe D'Angelo2013-02-121-4/+23
| | | | | | | | | | | We need to clarify what's the status of the implicit capturing group #0 in both of this methods. The former doesn't include it, while the latter does for convenience/consistency in the way we count the capturing groups. (Note that this last behavior is actually autotested.) Change-Id: I2170842c2a6dffa34fa56389ceead61a92c07cd1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: print a warning if (?J) is used in a patternGiuseppe D'Angelo2013-02-121-0/+8
| | | | | | | | | (?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 <thiago.macieira@intel.com>
* QRegularExpression: don't use study data when getting the pattern infoGiuseppe D'Angelo2013-02-121-1/+2
| | | | | | | | | | | | | | Information about the pattern (number of capturing groups, newline settings, etc.) are grabbed when the pattern is compiled the first time. Studying (=> optimizing) is always done later, after a certain amount of usages. In case this ever changes, add an assert. Besides, we're not grabbing any info that require studying the pattern first. Change-Id: Ica15fa21f7bf13213288d7090d3396a89900078e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: add method for extracting the capturing group namesGiuseppe D'Angelo2013-02-051-0/+48
| | | | | | | | | | | | | | | | It may be useful to know which named capturing groups are defined in an regular expression, and for each of them, what's the corresponding index. This commit adds the needed method to QRegularExpression. Note that extracting the information doesn't happen while holding the mutex in the private -- pcre_fullinfo just reads information from the compiled pattern, so that's thread-safe. Task-number: QTBUG-29079 Change-Id: I50c00ee860f06427c2e6ea10417d5c0733cc8303 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-2/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * QRegularExpression: fix wrong argument type for pcre_fullinfoGiuseppe D'Angelo2013-01-201-1/+1
| | | | | | | | | | | | | | | | | | The pcre(3) man page says that the 4th argument of pcre_fullinfo, when requesting PCRE_INFO_OPTIONS, should point to an unsigned long int variable. Change-Id: I72cd5ab208687715329566556c5f279db57f7872 Reviewed-by: Richard J. Moore <rich@kde.org>