my regexp is over the ocean...

0ffh spam at frankhirsch.net
Sat Jun 23 01:30:04 PDT 2007


Hi!

Can anybody tell me what I do wrong in the second alternative?

void testRE()
{
   // alternative 1 : works
   if (auto m=std.regexp.search("abcde","^abc"))
     printf("alt 1 match '%s'\n",toStringz(m.match(0)));
   else
     printf("alt 1 no match\n");
   // alternative 2 : why not?
   if (auto m=(RegExp("^abc").search("abcde")))
     printf("alt 2 match '%s'\n",toStringz(m.match(0)));
   else
     printf("alt 2 no match\n");
}

Regards, Frank


More information about the Digitalmars-d-learn mailing list