[pim/kitinerary/release/26.08] src/lib/uic9183: Deal with seat ranges in RCT2 reservations

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c09142cfc1bd9a3dedc5e9ad24edae78462d34db by Volker Krause.
Committed on 16/08/2026 at 09:14.
Pushed by vkrause into branch 'release/26.08'.

Deal with seat ranges in RCT2 reservations

(cherry picked from commit 40db8db75058ee6c02252a1e01eafeb86cb372f8)

M  +7    -8    src/lib/uic9183/rct2ticket.cpp

https://invent.kde.org/pim/kitinerary/-/commit/c09142cfc1bd9a3dedc5e9ad24edae78462d34db

diff --git a/src/lib/uic9183/rct2ticket.cpp b/src/lib/uic9183/rct2ticket.cpp
index 67266d89..51d70df7 100644
--- a/src/lib/uic9183/rct2ticket.cpp
+++ b/src/lib/uic9183/rct2ticket.cpp
@@ -80,20 +80,19 @@ QDateTime Rct2TicketPrivate::parseTime(const QString &dateStr, const QString &ti
 }
 
 static constexpr const char* res_patterns[] = {
-    "ZUG +(?P<train_number>\\d+) +(?P<train_category>[A-Z][A-Z0-9]+) +WAGEN +(?P<coach>\\d+) +PLATZ +(?P<seat>\\d[\\d, ]+)",
-    "ZUG +(?P<train_number>\\d+) +WAGEN +(?P<coach>\\d+) +PLATZ +(?P<seat>\\d[\\d, ]+)",
+    "ZUG +(?P<train_number>\\d+) +(?P<train_category>[A-Z][A-Z0-9]+) +WAGEN +(?P<coach>\\d+)[ /]+(?:PLATZ|PLÄTZE|SITZPLATZ|SITZPLÄTZE)[ /]+(?P<seat>\\d[\\d, -]+)",
+    "ZUG +(?P<train_number>\\d+) +WAGEN +(?P<coach>\\d+) +PLATZ +(?P<seat>\\d[\\d, -]+)",
 };
 
 QString Rct2TicketPrivate::reservationPatternCapture(QStringView name) const
 {
     const auto text = layout.text(8, 0, 72, 1);
     for (const auto *pattern : res_patterns) {
-      QRegularExpression re{QLatin1StringView(pattern),
-                            QRegularExpression::CaseInsensitiveOption};
-      Q_ASSERT(re.isValid());
-      const auto match = re.match(text);
-      if (match.hasMatch()) {
-        return match.captured(name);
+        QRegularExpression re{QString::fromUtf8(pattern), QRegularExpression::CaseInsensitiveOption};
+        Q_ASSERT(re.isValid());
+        const auto match = re.match(text);
+        if (match.hasMatch()) {
+            return match.captured(name);
         }
     }
     return {};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.