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. Making a QString satisfy QRegularExpression
Forum Updated to NodeBB v4.3 + New Features

Making a QString satisfy QRegularExpression

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 849 Views 2 Watching
  • 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.
  • ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by ModelTech
    #1

    How can I check that a QString satisfies a regular expression in a QRegularExpression? I know this can be done for QLineEdit, but now the QString originates from a file and not from a user input. QString::contains seems insufficient here as I need a match...

    K 1 Reply Last reply
    0
    • ModelTechM ModelTech

      How can I check that a QString satisfies a regular expression in a QRegularExpression? I know this can be done for QLineEdit, but now the QString originates from a file and not from a user input. QString::contains seems insufficient here as I need a match...

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @ModelTech

      There is an example for use of QRegularExpression available.
      I am using the older version QRegExp and its example. The example allows also to check externally of your code the regular expression string and its syntax with some text examples. The example code for QRegularExpression looks similar.

      There is another class QRegluarExpressionMatch

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi @ModelTech,

        The methods you want are QRegularExpression::match() and QRegularExpressionMatch::hasMatch()

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • ModelTechM Offline
          ModelTechM Offline
          ModelTech
          wrote on last edited by
          #4

          Thanks guys for these answers :)

          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