[Solved] Getting a bit crazy with QRegExp

  • I am looking for a way to extract strings enclosed by "<" and ">", as well as strings enclosed by double quotation marks.

    Combine QRegExp and what C++ does to literal strings, and I'm getting a bit crazy here.

    What certifiably doesn't work is:

    for strings enclosed in "<" and ">", as well as


    for strings enclosed in double quotation marks.

    Where do I go wrong?

  • Moderators

    your regexp is just wrong. Do this to capture the text:
    QRegExp re("<(.)>");
    re.setMinimal(true); //this is important
    Note: "
    " doesn''t stand for "abitrary charcater" but for "0 or more occurrences"

  • Thank you for saving my sanity!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.