I'm a bit worried about performance issue when calling RegEx.Replace to really big amount of strings since i have no idea what it does if there's no matches. 

```
public static void ReplaceOldWithNew(ref string input)
{
    string pattern = //something here
    input = Regex.Replace(input, pattern, FormatReplacement);
}

private string FormatReplacement(Match m)
{
    return String.Concat("x", formatCount++);
}

```

should I have it like this 

```
public static void ReplaceOldWithNew(ref string input)
{
    string pattern = //something here
    if (RegEx.IsMatch(input, pattern))
       input = Regex.Replace(input, pattern, FormatReplacement);
}

```

the problem with this is that it searches the input string two times if there is match(es). Is there any solution that would search the matches only once and make new string instance only if needed. Maybe using RegEx.Matches or something.

Thanks & BR - Matti