Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Getting a bit crazy with QRegExp
Qt 6.11 is out! See what's new in the release blog

[Solved] Getting a bit crazy with QRegExp

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 966 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    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:
    @([<])(*)([>])
    or
    <[>]@

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

    @(["])(*)(["])
    or
    "["]@

    for strings enclosed in double quotation marks.

    Where do I go wrong?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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"

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Thank you for saving my sanity!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved