regex(q"<[^]>")
Anton Fediushin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 18 01:56:12 PDT 2017
On Monday, 17 July 2017 at 17:00:10 UTC, unDEFER wrote:
> Hello!
> The code in the header leads to assertion!
> But the user inputed data don't must leads to any assertions!
This regular expression is invalid.
[bar] - Matches 'b' or 'a' or 'r'
[^bar] - Matches everything but 'b' or 'a' or 'r'.
So, [^] - is an invalid regex.
^ in this case should be escaped:
[\^] - matches '^'.
Not a bug, but I think that `regex()` should fail with a nice
exception, not silently fail.
More information about the Digitalmars-d
mailing list