www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - RegExp.match question

reply "Saaa" <empty needmail.com> writes:
const char[] re1 = `(re)1`;
const char[] re2 = `(re)2`;
char[] matchWrite(RegExp re)
{
writefln(re.match(1),`,`,re.match(2));
return "";
}
std.regexp.sub(`re1 re2`, re1~'|'~re2, &matchWrite, "g");

--- prints
re,
re,re // shouldn't this be `,re`? 
Aug 17 2009
parent BCS <ao pathlink.com> writes:
Reply to Saaa,

 const char[] re1 = `(re)1`;
 const char[] re2 = `(re)2`;
 char[] matchWrite(RegExp re)
 {
 writefln(re.match(1),`,`,re.match(2));
 return "";
 }
 std.regexp.sub(`re1 re2`, re1~'|'~re2, &matchWrite, "g");
 --- prints
 re,
 re,re // shouldn't this be `,re`?
I *think* you are correct. If I had to guess, I'd do with it's an old data issue.
Aug 18 2009