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

  • SEARCH
  • Home
  • 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 639549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:51:19+00:00 2026-05-13T20:51:19+00:00

I came accross a very strange problem with tr1::regex (VS2008) that I can’t figure

  • 0

I came accross a very strange problem with tr1::regex (VS2008) that I can’t figure out the reason for. The code at the end of the post compiles fine but throws an exception when reaching the 4th regular expression definition during execution:

Microsoft C++ exception: std::tr1::regex_error at memory location 0x0012f5f4..

However, the only difference I can see (maybe I am blind) between the 3rd and 4th one is the ‘NumberOfComponents’ instead of ‘SchemeVersion’. At first I thought maybe both (3rd and 4th) are wrong and the error from the 3rd is just triggered in the 4th. That seems not to be the case as I moved both of them around and put multiple other regex definitions between them. The line in question always triggers the exception.

Does anyone have any idea why that line

std::tr1::regex rxNumberOfComponents("\\NumberOfComponents:(\\s*\\d+){1}");

triggers an exception but

std::tr1::regex rxSchemeVersion("\\SchemeVersion:(\\s*\\d+){1}");

doesn’t? Is the runtime just messing with me?

Thanks for the time to read this and for any insights.
T

PS: I am totally sure the solution is so easy I have to hit my head against the nearest wall to even out the ‘stupid question’ karma …


#include <regex>

int main(void)
{
   std::tr1::regex rxSepFileIdent("Scanner Separation Configuration");
   std::tr1::regex rxScannerNameIdent("\\ScannerName:((\\s*\\w+)+)");

   std::tr1::regex rxSchemeVersion("\\SchemeVersion:(\\s*\\d+){1}");
   std::tr1::regex rxNumberOfComponents("\\NumberOfComponents:(\\s*\\d+){1}");

   std::tr1::regex rxConfigStartIdent("Configuration Start");
   std::tr1::regex rxConfigEndIdent("Configuration End");

   return 0;
}
  • 1 1 Answer
  • 4 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-05-13T20:51:19+00:00Added an answer on May 13, 2026 at 8:51 pm

    You need to double-escape your backslashes – once for the regex itself, a second time for the string they’re in.

    The one that starts with S works because \S is a valid regex escape (non-whitespace characters). The one that starts with N does not (because \N is not a valid regex escape).

    Instead, use "\\\\SchemeVersion: et cetera.

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

Sidebar

Related Questions

I came accross something very strange when i was testing my pages in FireFox.
I've came across strange issue. I know I'm missing something very minor. Can Any
I recently came across a piece of code, that I thought was very funny.
I came across this very simple code, and it seems to me that we
I came accross this code on the web: is_char(Ch) -> if Ch < 0
I came accross a weird problem, I want to do some basic math checks.
I've run into a very strange problem in Eclipse, and I'm not sure if
Recently I came across a character range that was the following: [/-+] My very
I recently came across a very very strange, and very bad bug in jQuery
I came across a very strange behaviour using G++ (4.5.2) on different platforms; here's

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.