Results 1 to 6 of 6

Thread: Non-greedy (lazy) RegExp in QtScript

  1. #1
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Exclamation Non-greedy (lazy) RegExp in QtScript

    Qt's QRegExp does not support the "?" modifier for the quantifiers, and neither RegExp from QtScript does.

    However in Qt/C++ one can use QRegExp::setMinimal() to make the quantifiers non-greedy.

    But how to do it in QtScript?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Non-greedy (lazy) RegExp in QtScript

    Ask yourself (or your favourite search engine) how to do it in JavaScript.

    http://www.regular-expressions.info/javascript.html
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Non-greedy (lazy) RegExp in QtScript

    The link you provided does not say a word about the problem.

    In JavaScript the only way I'm aware of is using the ? modifier.
    There is no global modifier for the entire regexp, like "i" for case insensitiveness.
    And there seems to be no RegExp object's method which allows this.

    So since Qt does not support the ? modifier, it should enable other way of making the QtScript's RegExp non-greedy.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Non-greedy (lazy) RegExp in QtScript

    Quote Originally Posted by ultr View Post
    The link you provided does not say a word about the problem.
    It says the problem is outside the scope of this forum.

    In JavaScript the only way I'm aware of is using the ? modifier.
    Then why don't you use it?

    So since Qt does not support the ? modifier, it should enable other way of making the QtScript's RegExp non-greedy.
    Qt Script is an implementation of ECMAScript (aka JavaScript), not a full blown separately maintained product. You can always export QRegExp to your script if you want it available there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Non-greedy (lazy) RegExp in QtScript

    In JavaScript the only way I'm aware of is using the ? modifier.
    Then why don't you use it?
    Simply because it does not work in QtScript.


    I will try exporting QRegExp. I hope it won't requite more exports, since these scripts are meant to be an easy interface for users. They should be able to use it just like JavaScript without reading tons of additional documentation.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Non-greedy (lazy) RegExp in QtScript

    Quote Originally Posted by ultr View Post
    Simply because it does not work in QtScript.
    How exactly did you try it?

    I will try exporting QRegExp. I hope it won't requite more exports, since these scripts are meant to be an easy interface for users. They should be able to use it just like JavaScript without reading tons of additional documentation.
    You can export any function you want in a way you see fit. It will not require anything unless you make it require something.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 7th May 2010, 04:13
  2. Replies: 0
    Last Post: 25th November 2009, 08:46
  3. QStandardItemModel Lazy Population
    By AaronMK in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2009, 09:05
  4. Replies: 1
    Last Post: 9th August 2009, 20:51
  5. Lazy population of QAbstractModel
    By bastien in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 21:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.