Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error message #168

Open
olivier-75 opened this issue Nov 12, 2021 · 0 comments
Open

Wrong error message #168

olivier-75 opened this issue Nov 12, 2021 · 0 comments

Comments

@olivier-75
Copy link

Windows Platform, using gcc 11.2 and boost 1.77

With regex [a-e the error message is wrong, referencing unbalanced parenthesis, instead of unmatched [
Error message : Found a closing ) with no corresponding opening parenthesis. The error occurred while parsing the regular expression: '[a-e>>>HERE>>>'. at 4

`#include <boost/regex.hpp>
#include
#include

int main()
{
std::string s = "Boost Libraries Test";
try
{
// regex contains error : missing ]
boost::regex expr{"[a-e"};
boost::smatch what;
if (boost::regex_search(s, what, expr))
std::cout << "Found !" << '\n';
else
std::cout << "Nothing !" << '\n';
}
catch(boost::regex_error& ex)
{
std::cout << ex.what() << " at " << ex.position() << "\n";
}
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant