Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9367

Regular Expressions are not handled correctly in QML.

XMLWordPrintable

    • 31b972b12db4497f1c3ba1762d784c7315e75b62

      The following does not work correctly in QML. The problem seems to be occurring early – AST::RegExpLiteral node only keeps a single SourceLocation, and that location has a length of 1. The script parser uses that to turn the regexp /[a-zA-z]{2,4}/ into the QString expression "/". After passing through the rewriter we end up with a binding with an empty expression.

      import Qt 4.7
      
      Rectangle {
          id: container
          width: 400
          height: 400
      
          TextInput { id: strInput;
              validator: QRegExpValidator {
                  regExp: /[a-zA-z]{2,4}/
              }
          }
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            raggi Roberto Raggi
            brasser Michael Brasser (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes