-5

When I try to make this pattern in c++ the compiler gives me a runtime error

regex IntegerWSign("^((-)|(\+))[0-9]{1,}$");
Barmar
  • 669,327
  • 51
  • 454
  • 560
momo_hoho
  • 1
  • 1

1 Answers1

0

\+ is the valid notation in a regular expression, but inside a C++ string that needs to be \\+.

Your expression was being interpreted as:

^((-)|(+))[0-9]{1,}$

Where that's not valid.

tadman
  • 200,744
  • 21
  • 223
  • 248