using std.regex with (A|B) patterns.
Dmitry Olshansky
dmitry.olsh at gmail.com
Mon Nov 19 11:06:35 PST 2012
11/19/2012 11:55 AM, Aquiles пишет:
>
> Hello,
>
> While instantiating a floating point regex using
> ctRegex!"\\b[-+]?([0-9]*\\.[0-9]+|[0-9]+)\\B", I got a compiler error
> (see below.) The offending character seems to be '|' and when escaped it
> compiles.
>
> I can reproduce it with a simpler regex:
>
> assert ( match("A", ctRegex!"A|B") );
> assert ( match("A", ctRegex!r"A|B") );
>
See the bug:
http://d.puremagic.com/issues/show_bug.cgi?id=7440
The main cause was a compiler bug and is fixed in the upstream. Now the
only piece left is this tiny problem in the standard library:
http://d.puremagic.com/issues/show_bug.cgi?id=8349
The root of problem is that ctRegex is not throughly tested at the
moment (still takes too much time to compile) and certain changes to the
standard library broke it silently.
There is a pull to just fix it:
https://github.com/D-Programming-Language/phobos/pull/936
And another that reworks the whole std.algorithm.move more properly and
fixes it:
https://github.com/D-Programming-Language/phobos/pull/923
That should be the up to date status on this.
Anyway I'm making sure it works as expected in v2.061 when it's out.
> Any ideas on how to make (A|B) type regex's using std.regex?
For the moment use run-time version that is simply regex not ctRegex.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list