tango -D2 regex

seany seany at uni-bonn.de
Tue Dec 17 10:16:19 PST 2013


On Monday, 16 December 2013 at 17:20:59 UTC, Dmitry Olshansky 
wrote:
> 16-Dec-2013 11:46, seany пишет:
>> I dont find any info on backtrack on tango-D2 regex.
>>
>> For example, I want to match things like
>>
>> barFOObar
>>
>> or
>>
>> bazFOObaz
>>
>> so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the 
>> word (given
>> by \w*  that was matced in the first subpattern (\w*)
>
> With std.regex of Phobos this should just work.
>
> auto re = regex(`^(\w*)FOO\1$`);
>
> assert("barFOObar".match(re));
>
> Syntax is like in JavaScript or Perl.
>
>>
>> How to do the samein Tango for D2 (or even phobos for D2)?

thanks! this is what i was looking for (the \1)


More information about the Digitalmars-d-learn mailing list