Results 1 to 6 of 6

Thread: How to split string using QRegex?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,327
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to split string using QRegex?

    For one thing, QRegularExpressionMatch::captured() with a '0' argument returns the -entire- capture, not the first one. captured( 1 ) should be returning your first string, not the second. QRegularExpressionMatch::capturedTexts() will return all of them as a QStringList.

    And try using QRegularExpression::globalMatch() instead of match().
    Last edited by d_stranz; 14th April 2020 at 16:57.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. how to split a big string?
    By aurora in forum Newbie
    Replies: 2
    Last Post: 21st February 2012, 06:10
  2. Split string
    By mero in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2011, 19:17
  3. split camel case string
    By GrahamLabdon in forum Newbie
    Replies: 5
    Last Post: 1st February 2011, 16:37
  4. How to split a string line
    By grsandeep85 in forum Newbie
    Replies: 5
    Last Post: 29th July 2009, 10:42
  5. How to split a string line
    By grsandeep85 in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 10:28

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