Remove the static int from this MatchEvaluator
<p>I'm trying to convert a proprietary string mask to the .net equivalent of it.
For that I need to exchange every occurance of [someText] with {aDigit}.</p>

<pre><code>private static int hits = 0;
private static object hitsLock = new object();

public static string ConvertSdsFileMaskToStringMask(string sdsFileMaskString) {
 Regex bracketsExpression = new Regex(@"\[[^[]*]");
 lock (hitsLock)
 {
  hits = 0;
  return bracketsExpression.Replace(sdsFileMaskString, ReplaceSquareWithAngularBrackets);
 }
}
private static string ReplaceSquareWithAngularBrackets(Match m) {
 string result = String.Format("{{{0}}}", hits.ToString());
 hits++;
 return result;
}
</code></pre>

<p>It works. But both expressions need to know each other's workings and are depending on the hits counter. I feel this could be improved. Ideally both have no dependency on each other. Any suggestions? 
This can probably be done better. Any suggestions?</p>
