using System; using System.Collections.Generic; using System.Text.RegularExpressions; namespace RhinoReminds.Utilities { public static class TextHelpers { public static string ReplaceMultiple(this string input, IEnumerable regexes, IEnumerable replacements, RegexOptions options = RegexOptions.None) { using (IEnumerator regexIterator = regexes.GetEnumerator()) using (IEnumerator replacementsIterator = replacements.GetEnumerator()) { while (regexIterator.MoveNext() && replacementsIterator.MoveNext()) { input = Regex.Replace( input, regexIterator.Current, replacementsIterator.Current, options ); } } return input; } } }