On 7/06/2014 12:01 a.m., AntonSotov wrote:
const r1 = regex("bla");
matchFirst( "big string", r1 );  //  ERROR!

immutable r2 = regex("bla"); //  ERROR!

Why can I not use const/immutable regex?

In none of your examples you have not defined the type of the variables. However you are giving it an access modifier.
I assume you are wanting auto.

import std.regex;

void main() {
        const auto r1 = regex("bla");
        pragma(msg, typeof(r1));
}

Compilation output:
const(Regex!char)

Reply via email to