Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8760069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:57:20+00:00 2026-06-13T14:57:20+00:00

Possible Duplicate: No matches with c++11 regex I was reading this book that covers

  • 0

Possible Duplicate:
No matches with c++11 regex

I was reading this book that covers C++11 and I got to the chapter that talks about Regular Expressions. Everything was working fine for me until I got the part about grouping and referring to \1 whenever I needed to refer back to a group. My code compiles perfectly fine :

#include <iostream>
#include <regex>
#include <string>
int main()
{
     try
     {


           regex r1("<(.*)>.*</\\1>");
           bool found = regex_match(string("<tag>value</tag>"),r1);
           cout << "Does the string match:        ";
           cout << boolalpha << found << '\n';
     }catch( exception e)
     {
        cout << e.what() << '\n';
     }

     return 0;
}

What happens however is I get a segmentation fault (core dumped) message. This little snippet was used directly from the book so I highly doubt this is wrong.
Note: I do compile using -std=c++0x.
Note: I’m using Code::Blocks under Ubuntu 12.04

Any help would be highly appreciated!
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:57:21+00:00Added an answer on June 13, 2026 at 2:57 pm

    libstdc++’s implementation of regex is HILARIOUSLY incomplete.

    http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011

    Head down to section 28, regular expressions. If you’re using libstdc++ (which is almost certain as you’re on ubuntu) then you cannot use regex yet.

    It’s a shame, because g++’s toolchain for C++11 is otherwise extremely solid.

    You’ll need to use boost for this probably, or another regex library. Or change over the clang (and clang’s libraries) or to MSVC (and their libraries).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Regular expression that matches valid IPv6 addresses Can any one know the
Possible Duplicate: Using C# regular expressions to remove HTML tags Regex Pattern in C#
Possible Duplicate: Regular Expressions: Is there an AND operator? I let my users enter
Possible Duplicate: Python: find first element in a sequence that matches a predicate Is
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I have this list
Possible duplicate: Print regex matches in java I am using Matcher class in java
Possible Duplicate: Use regular expressions to validate passwords I'm trying to code a php
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.