Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use QString to retrieve data from regular expression

Use QString to retrieve data from regular expression

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 196 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    This code removes all matching the expression

    result = source.remove(QRegularExpression (expression));

    I need the opposite - retrieve all matching the expression - using QString.
    I did look thru QSiring doc and cannot figure out which function would accomplish my task...

    I did try append and getting this error - so passing QString to "append" is no good...

    /mnt/MDI_RAID_5/MDI_WORK_COPY_FOLDER/MDI_BT_Aug14_BASE/MDI_BT/MDI_BT/C_BLUETOOTHCTL/C_bluetoothctl/mainwindow_bluetoothctl.cpp:6542: error: no matching function for call to ‘QString::append(QRegularExpression)’
    mainwindow_bluetoothctl.cpp: In member function ‘QString MainWindow_Bluetoothctl::SubRegularExpressionExt(QString, QString, int)’:
    mainwindow_bluetoothctl.cpp:6542:35: error: no matching function for call to ‘QString::append(QRegularExpression)’
    6542 | result = source.append(QRegularExpression (expression));
    | ~^~~~~~~~~~~~~~~~~~~~~

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Use QRegularExpression::match() and iterate over your string with this.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        Just figured that also...
        Does the job.
        Thanks for the quick response I appreciate that.

        SOLVED

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved