From 896de03d87aa3e2d708ba110bf4f3f2560c21469 Mon Sep 17 00:00:00 2001 From: Mike Walters Date: Fri, 15 Aug 2025 07:35:30 +0100 Subject: [PATCH] Switch from QRegExp to QRegularExpression --- src/mainwindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dc62d76..edebe38 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -72,12 +72,13 @@ void MainWindow::openFile(QString fileName) // Try to parse osmocom_fft filenames and extract the sample rate and center frequency. // Example file name: "name-f2.411200e+09-s5.000000e+06-t20160807180210.cfile" - QRegExp rx("(.*)-f(.*)-s(.*)-.*\\.cfile"); + QRegularExpression rx(QRegularExpression::anchoredPattern("(.*)-f(.*)-s(.*)-.*\\.cfile")); QString basename = fileName.section('/',-1,-1); - if (rx.exactMatch(basename)) { - QString centerfreq = rx.cap(2); - QString samplerate = rx.cap(3); + auto match = rx.match(basename); + if (match.hasMatch()) { + QString centerfreq = match.captured(2); + QString samplerate = match.captured(3); std::stringstream ss(samplerate.toUtf8().constData());