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

The documentation for the \0 escape doesn't match the implementation #216

Open
tlemo opened this issue Nov 8, 2024 · 2 comments
Open

The documentation for the \0 escape doesn't match the implementation #216

tlemo opened this issue Nov 8, 2024 · 2 comments
Labels
doc Something needs to be clarified or corrected in the documentation

Comments

@tlemo
Copy link
Contributor

tlemo commented Nov 8, 2024

The documentation says that \0 matches the NUL character, but at least when using the default matcher, \0 seems to be treated as the prefix for an octal encoding of a character

@genivia-inc
Copy link
Member

Thank you for your feedback! Will be fixed.

@genivia-inc genivia-inc added the doc Something needs to be clarified or corrected in the documentation label Nov 12, 2024
@genivia-inc
Copy link
Member

The problem is actually in the regex converter, which takes the "signature" of a regex engine to make sure it complies and also converts non-supported regex syntax to syntax the the regex engine supports.

Line 53 in include/reflex/matcher.h should be updated to add a 0 after the W to natively support \0 escapes:

static std::string convert(T regex, convert_flag_type flags = convert_flag::none, bool *multiline = NULL)
{
  return reflex::convert(regex, "imsx#=^:abcdefhijklnrstuvwxzABDHLNQSUW0<>?", flags, multiline);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Something needs to be clarified or corrected in the documentation
Projects
None yet
Development

No branches or pull requests

2 participants