[pcre-dev] [Bug 2362] bad_escape_is_literal influences 'inva…

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2362] bad_escape_is_literal influences 'invalid range' check
https://bugs.exim.org/show_bug.cgi?id=2362

--- Comment #1 from Philip Hazel <ph10@???> ---
Hmm. This is arguable, unfortunately. The pcre2api documentation says this:
"If the PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL extra option is passed to
pcre2_compile(), all unrecognized or erroneous escape sequences are
treated as single-character escapes." It could be argued that in the fragment
[_-\s] the sequence "\s" is an "erroneous escape sequence" and therefore it
should be treated as a literal "s", which is exactly what happens.

However, it is also sensible that [\s-_] should be treated the same as [_-\s]
so one or the other must change. It is probably less confusing to make them
both give errors, and to clarify the documentation as to what constitutes an
"erroneous escape sequence". I will do that.

Note that pcre2api also says "Setting this option
(PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL) means that typos in patterns may go
undetected and have unexpected results. This is a dangerous option. Use with
care."

--
You are receiving this mail because:
You are on the CC list for the bug.