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

QML JS RegExp doesn't work with lookbehinds

    XMLWordPrintable

Details

    • All

    Description

      QML JS RegExp with lookbehinds (positive and negative) doesn't work as expected.

      example:

              // positive lookahead test
              const plaMatch = /foo(?=bar)/g.exec('foobar foobaz');
              console.assert(plaMatch != null, "Positive lookahead failed!") // PASS
      
              // negative lookahead test
              const nlaMatch = /foo(?!bar)/g.exec('foobar foobaz');
              console.assert(nlaMatch != null, "Negative lookahead failed!") // PASS
      
              // positive lookbehind test
              const plbMatch = /(?<=foo)bar/g.exec('foobar fuubar');
              console.assert(plbMatch != null, "Positive lookbehind failed!") // FAILED!
      
              // negative lookbehind test
              const nlbMatch = /(?<!foo)bar/g.exec('foobar fuubar');
              console.assert(nlbMatch != null, "Negative lookbehind failed!") // FAILED!
      

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              studiosus Vladimir Belyavsky
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes