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. [Solved]Invalidate "\" with QRegExpValidator
Forum Updated to NodeBB v4.3 + New Features

[Solved]Invalidate "\" with QRegExpValidator

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k Views 1 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    @ui_->nameTemplateEdit->setValidator(new QRegExpValidator(QRegExp("[^\<>?:|"]"), this) );@

    I could invalidate "<", ">", "?", ":", "*", "|", """ but can't invalidate ""
    How could I fix this?Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      The first escape sequence escapes from the C++ compiler, the second one from the regular expression.
      So to get a "" in the regular expression literally, you write "\" as regexp.
      To get "\" in a C++ string, you write "\\" in the code file.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        Thank you very much

        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