std.regex literal syntax (the \Q…\E escape sequence)

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Dec 18 10:33:18 PST 2013


I'm reading through http://www.regular-expressions.info, and there's a
feature that's missing from std.regex, quoted:

-----
All the characters between the \Q and the \E are interpreted as
literal characters. E.g. \Q*\d+*\E matches the literal text *\d+*. The
\E may be omitted at the end of the regex, so \Q*\d+* is the same as
\Q*\d+*\E.
-----

This would translate to the following needing to work (which fails at
runtime with an exception):

writeln(r"*\d+*".match(r"\Q*\d+*\E"));

Should this feature be added? I guess there's probably more regex
features missing (I just began reading the page), I'm not sure how
Dmitry feels about adding X number of features though.


More information about the Digitalmars-d-learn mailing list