Hello,
It seems as if character types are *never* allowed adjacent to character types, even in cases where it could make sense:
echo -n '[\W--a]'|test_pcre2 a
PCRE2 version 10.45-DEV 2024-06-09 (8-bit)
/[\W--a]/debug
Failed: error 150 at offset 3: invalid range in character class
a
(I have a little test script `test_pcre2` that uses pcre2test given a parttern and a subject)
Here, the \W is not part of the range: the renge strats with '-', so the error message is not entirely correct. If I instead put `[--a\W]`, it works fine, of course.
The reason I ask is that I am working on a parser for PCRE2, and want to know exectly how hyphens and character types may or may not be adjacent to each other in character classes. I believe it is never allowed, right? I can always let the parser be forgiving, and have a post-check that rejects certain expressions.
Best regards,
David