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. Qt regex modifier
Forum Updated to NodeBB v4.3 + New Features

Qt regex modifier

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 6.1k 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @yodusow-bardon said:

    Hi
    I wonder if
    QRegularExpression::UseUnicodePropertiesOption 0x0040
    http://doc.qt.io/qt-5/qregularexpression.html
    is what you are after?

    ? 1 Reply Last reply
    0
    • mrjjM mrjj

      @yodusow-bardon said:

      Hi
      I wonder if
      QRegularExpression::UseUnicodePropertiesOption 0x0040
      http://doc.qt.io/qt-5/qregularexpression.html
      is what you are after?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #3

      @mrjj I tried it too and it doesn't work. I my case I tried - it would match anything, including unicode characters:

      [a-z\u00a1-\uffff0-9]*
      

      And when calling isValid it returns false along with the same warning, even using UseUnicodePropertiesOption.

      mrjjM 1 Reply Last reply
      0
      • ? A Former User

        @mrjj I tried it too and it doesn't work. I my case I tried - it would match anything, including unicode characters:

        [a-z\u00a1-\uffff0-9]*
        

        And when calling isValid it returns false along with the same warning, even using UseUnicodePropertiesOption.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @Minupi said:
        hmm looking in
        qregularexpression.cpp
        I only see
        QT_TRANSLATE_NOOP("QRegularExpression", "PCRE does not support \L, \l, \N{name}, \U, or \u"),

        but at same time docs says "It fully supports Unicode"

        Does it work if u put the unicode directly in the string ?

        ? 1 Reply Last reply
        0
        • mrjjM mrjj

          @Minupi said:
          hmm looking in
          qregularexpression.cpp
          I only see
          QT_TRANSLATE_NOOP("QRegularExpression", "PCRE does not support \L, \l, \N{name}, \U, or \u"),

          but at same time docs says "It fully supports Unicode"

          Does it work if u put the unicode directly in the string ?

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #5

          @mrjj I might, but the thing is that I need to use \u as it has a range: \uffff0-9.

          I think that I'm going to drop the QRegularExpression and use QRegExp instead.

          mrjjM 1 Reply Last reply
          0
          • ? A Former User

            @mrjj I might, but the thing is that I need to use \u as it has a range: \uffff0-9.

            I think that I'm going to drop the QRegularExpression and use QRegExp instead.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Minupi said:
            Well if it just accepts a \u I agree it seems more sensible than to figure out how to do \u like with QRegularExpression.

            ? 1 Reply Last reply
            0
            • mrjjM mrjj

              @Minupi said:
              Well if it just accepts a \u I agree it seems more sensible than to figure out how to do \u like with QRegularExpression.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              @mrjj It's kinda nonsense as QRegularExpresion came to be better than QRegExp, but anyway, let's stick with it as it's the only option left here.

              Thank you.

              mrjjM 1 Reply Last reply
              1
              • ? A Former User

                @mrjj It's kinda nonsense as QRegularExpresion came to be better than QRegExp, but anyway, let's stick with it as it's the only option left here.

                Thank you.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @yodusow-bardon said:
                btw
                did u try
                \x{FFFF}

                ? 2 Replies Last reply
                1
                • mrjjM mrjj

                  @yodusow-bardon said:
                  btw
                  did u try
                  \x{FFFF}

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #9

                  @mrjj Yes, I did and I got an error saying:

                  hex constants must have at least one hex digit

                  1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @yodusow-bardon said:
                    btw
                    did u try
                    \x{FFFF}

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #10

                    @mrjj I fixed it, and it's working now... You just have to escape the \x, like \\x, for instance: [a-z\\x{00a1}-\\x{ffff}0-9]*.

                    mrjjM 1 Reply Last reply
                    0
                    • ? A Former User

                      @mrjj I fixed it, and it's working now... You just have to escape the \x, like \\x, for instance: [a-z\\x{00a1}-\\x{ffff}0-9]*.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #11

                      @Minupi
                      Oh yes always escape "\"
                      Super- :)

                      ? 1 Reply Last reply
                      1
                      • mrjjM mrjj

                        @Minupi
                        Oh yes always escape "\"
                        Super- :)

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #12

                        @mrjj Thank you, helped a lot. I realised that QRegularExpression is using the same syntax as PHP.

                        mrjjM 1 Reply Last reply
                        0
                        • ? A Former User

                          @mrjj Thank you, helped a lot. I realised that QRegularExpression is using the same syntax as PHP.

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          @Minupi
                          Good to hear. :)
                          It says its perl syntax but maybe PHP uses perl style or reverse?

                          ? 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @Minupi
                            Good to hear. :)
                            It says its perl syntax but maybe PHP uses perl style or reverse?

                            ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #14

                            @mrjj Yes, it resembles perl style, it's called PCRE.

                            1 Reply Last reply
                            1
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              Hi,

                              To help you with your regular expression development, you can use the regular expression tool. It's available starting with Qt 5.6

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1

                              • Login

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