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. Alternate for regexp in sqlite
Forum Update on Monday, May 27th 2025

Alternate for regexp in sqlite

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 285 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.
  • D Offline
    D Offline
    dsba
    wrote on last edited by
    #1

    Hi,

    I was trying to get the count of id that starts from 712 where id is of 6 digit number. But this fails and always print 0 whereas I tried on db sqlite browser, then it prints 80 whose command mentioned

    SELECT COUNT(*) AS RowCnt from testTable where id regexp '712'

    Is there any other alternative to perform same operation from qt, if so kindly help me know?

    Thanks in advance

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

      @dsba said in Alternate for regexp in sqlite:

      Is there any other alternative to perform same operation from qt

      I don't see why it should not work with Qt. Please show us your code.

      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
      • D dsba

        Hi,

        I was trying to get the count of id that starts from 712 where id is of 6 digit number. But this fails and always print 0 whereas I tried on db sqlite browser, then it prints 80 whose command mentioned

        SELECT COUNT(*) AS RowCnt from testTable where id regexp '712'

        Is there any other alternative to perform same operation from qt, if so kindly help me know?

        Thanks in advance

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @dsba Why don't you use https://www.w3schools.com/sql/sql_like.asp ?
        Should it not be like:

        SELECT COUNT(*) AS RowCnt from testTable where id regexp '712.*'
        
        

        ?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        3
        • D Offline
          D Offline
          dsba
          wrote on last edited by dsba
          #4

          Hi
          Thanks for the reply
          I could do using 'like' statement of sqlite
          SELECT COUNT(*) AS RowCnt from testTable where id like '712%'
          this resolved the issue

          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