May 29, 2013
See below:

import std.stdio;
import std.regex;

void main(){
	"h(i".replace!(a=>a.hit~a.hit)(regex(`h\(`,"g")).writeln; //this works, but I need to specify the escape manually
//	"h(i".replace!(a=>a.hit~a.hit)(regex(`h(`,"gl")).writeln;  //I'd like this to work with a flag, say 'l' (lowercase L) as in 'litteral'.
}

note, std.array.replace doesn't work because I want to be able to use std.regex' replace with delegate functionality as above.
This is especially useful when the regex's first argument is given as an input argument (ie is unknown), and we want to properly escape it.

Alternatively, (and perhaps more generally), could we have a function:
string toRegexLiteral(string){
//replace all regex special characters (like '(' ) with their escaped equivalent
}