From 04e22d8719dabb33de38eea5cdf4199d147b7b28 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 20 Mar 2022 10:52:52 +0100 Subject: rbutil: Replace use of QRegExp with QRegularExpression. Change-Id: Ie89057a9857bc66612cb15fef81d3ca6c3e71b4c --- utils/rbutilqt/base/system.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'utils/rbutilqt/base/system.cpp') diff --git a/utils/rbutilqt/base/system.cpp b/utils/rbutilqt/base/system.cpp index a1d3d1165d..0ec1a9d424 100644 --- a/utils/rbutilqt/base/system.cpp +++ b/utils/rbutilqt/base/system.cpp @@ -418,10 +418,11 @@ QMultiMap System::listUsbDevices(void) // the keys (W7 uses different casing than XP at least), in addition // XP may use "Vid_" and "Pid_". QString data = QString::fromWCharArray(buffer).toUpper(); - QRegExp rex("USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4}).*"); - if(rex.indexIn(data) >= 0) { + QRegularExpression regex("^USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4})&REV_([0-9A-F]{4})$"); + QRegularExpressionMatch match = regex.match(data); + if(match.hasMatch()) { uint32_t id; - id = rex.cap(1).toUInt(0, 16) << 16 | rex.cap(2).toUInt(0, 16); + id = match.captured(1).toUInt(0, 16) << 16 | match.captured(2).toUInt(0, 16); usbids.insert(id, description); LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16); } -- cgit v1.2.3