Results 1 to 5 of 5

Thread: qregexp can't get match 'not preceeded by' to work

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    58
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Windows

    Default qregexp can't get match 'not preceeded by' to work

    Hi I can't figure out the regex to match any number not preceded by '['

    I don't know why this doesn't work:

    QRegExp n( "(?![)[0-9]+" );

    I could also get the match I want by searching for a number not followed by ']' but I can't get that regex to work either:

    QRegExp n( "[0-9]+(?!])" );

    I have tried many variations of this, including escaping the ]'s like this --> "(?!\\])" --- but i can't get my match.

    Just to be clear I want to match 150 but not [150].

    Also, I would use "[^[]" but that would not match a number at the very beginning of the line.

    What am I missing?
    Thanks.
    Last edited by kja; 25th July 2011 at 02:11.

Similar Threads

  1. Multiline match with QRegExp
    By bender86 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2016, 15:14
  2. Replies: 1
    Last Post: 10th March 2010, 18:19
  3. Replies: 1
    Last Post: 21st September 2009, 07:30
  4. QRegExp match all excpet "_"
    By mattia in forum Newbie
    Replies: 6
    Last Post: 28th March 2008, 12:53
  5. QRegExp doesn't seem to work as it should
    By thomaspu in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2007, 07:49

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
  •  
Qt is a trademark of The Qt Company.