www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - my regexp is over the ocean...

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
Jun 23 2007