Udger.Parser.PerlRegExpConverter.ModifyRegExpAnchored C# (CSharp) Method

ModifyRegExpAnchored() private static method

Modifies regular expression so it matches only at the beginning of the string.
private static ModifyRegExpAnchored ( string &expr ) : void
expr string Regular expression to modify.
return void
        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, "^");
        }