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

Closed
tlemo opened this issue Nov 8, 2024 · 3 comments
Closed

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

tlemo opened this issue Nov 8, 2024 · 3 comments
Labels
doc Something needs to be clarified or corrected in the documentation patch A patch to fix an issue

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);
}

@genivia-inc genivia-inc added the patch A patch to fix an issue label Nov 22, 2024
@genivia-inc
Copy link
Member

I've committed a minor update that will be included in the next official release 5.1.

genivia-inc added a commit that referenced this issue Nov 29, 2024
- fix #217 appease warnings
- fix #216
- fix a bug in case-insensitive Unicode negated character class matching too much
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 patch A patch to fix an issue
Projects
None yet
Development

No branches or pull requests

2 participants