Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved How to use std::regex in QtCreator?

    General and Desktop
    2
    3
    566
    Loading More Posts
    • 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.
    • nbds
      nbds last edited by

      Greetings,

      the following C++ code line causes a crash (segfault) when debugging in QtCreator:

      std::regex rg("^\\s*someText\\s*");
      

      The following variant crashes as well:

      std::basic_string<char> s("^\\s*someText\\s*");
      std::regex rg(s);
      

      Is there some special handling which is needed for std::regex?

      (P.S. I know about Qt regex classes. Can std::regex be used in Qt?)

      Thanks.

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User last edited by

        Hi, and welcome to the Qt forum! That's not a problem specific to Qt but to your compiler. I guess you run GCC 4.8.x. You'll need at least 4.9.x for regex to work as expected. See also: http://en.cppreference.com/w/cpp/regex

        1 Reply Last reply Reply Quote 2
        • nbds
          nbds last edited by

          Thank you very much for quick response and solving the problem.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post