using std.regex with (A|B) patterns.

Aquiles aquiles.a.lopez at gmail.com
Sun Nov 18 23:55:39 PST 2012


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") );

Any ideas on how to make (A|B) type regex's using std.regex?

------------------------------------------------------------------
/usr/include/dmd/phobos/std/regex.d(1150): Error: 
assert(this.ir[cast(ulong)orStart].code() == cast(IR)129u) failed
/usr/include/dmd/phobos/std/regex.d(876):        called from 
here: this.parseRegex()
/usr/include/dmd/phobos/std/regex.d(6459):        called from 
here: parser.this(pattern,flags)
/usr/include/dmd/phobos/std/regex.d(6443):        called from 
here: regexImpl(pattern,flags)
/usr/include/dmd/phobos/std/regex.d(6468):        called from 
here: regex("\\b[-+]?([0-9]*\\.[0-9]+|[0-9]+)\\B",[])



More information about the Digitalmars-d-learn mailing list