private static void ModifyRegExpAnchored(ref string expr)
{
// anchored means regular expression should match only at the beginning of the string
// => add ^ at the beginning if there is no one.
if (expr.Length == 0 || expr[0] != '^')
expr.Insert(0, "^");
}