Consider this:

import std.stdio, std.regex, std.array, std.algorithms ;

void main(string args[])
{

string[] greetings = ["hello", "hallo", "hoi", "salut"];

regex r = regex("hello", "g");

for(short i = 0; i < greetings.count(); i++)
{

  auto m = match(greetings[i], r);
}

}

To the best of my knowledge, declaring a variable inside a for loop is illegal, you can not delacre the same variable repeatedly over the iterations.

Also just the declaration auto m; outside the for loop does not make sense either - auto needs an Right Hand Side expression.

So what is the correct way of doing it?

Reply via email to