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

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Dec 18 12:06:27 PST 2013


18-Dec-2013 23:54, Andrej Mitrovic пишет:
> On 12/18/13, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:
>> P.S. This reminds me to put a roadmap of sorts on where std.regex is
>> going and what to expect.
>
> Btw one thing I'm not fond of is the format specifiers, in particular:
>
> $` 	part of input preceding the match.
> $' 	part of input following the match.
>
> ` and ' are very hard to tell apart. But I guess this was based on an
> existing standard? Personally I'd prefer $< and $>.
>
The precedent is Perl. A heavy influencer on the (former) std.regex design.
http://perldoc.perl.org/perlre.html#Capture-groups
(grep for $')

Personally I'd prefer both simply gone :) Reasoning is that you can't 
support these while pattern matching on the fly (say on a network 
stream). Since we can't do that - anything better that is popular enough 
is acceptable.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list