protected static string replaceOrThrow(string input, Regex pattern, Func <Match, string> evaluator, int count, int startat, TweakException toThrowIfNoReplacement)
        {
            bool wasReplaced = false;

            string result = pattern.Replace(input, match => {
                wasReplaced = true;
                return(evaluator(match));
            });

            if (!wasReplaced)
            {
                throw toThrowIfNoReplacement;
            }
            else
            {
                return(result);
            }
        }
 protected static string replaceOrThrow(string input, Regex pattern, Func <Match, string> evaluator, TweakException toThrowIfNoReplacement) => replaceOrThrow(input, pattern, evaluator, -1,
                                                                                                                                                              (pattern.Options & RegexOptions.RightToLeft) != 0 ? input.Length : 0, toThrowIfNoReplacement);