boostorg / boostorg/regex

Wrong error message

Open
#168 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
119
Forks
113
PR merge metrics
No merged PRs in 30d

Description

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
#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";
}
}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.