title: C# String replacement using Regex
body: <p>I currently have the code below, to replace a characters in a string but I now need to replace characters within the first X (in this case 3) characters and leave the rest of the string. In my example below I have 51115 but I need to replace any 5 within the first 3 characters and I should end up with 61115.</p>
  
  <p>My current code:</p>
  
  <pre><code>value = 51115;
  oldString = 5;
  newString = 6;
  
  result = Regex.Replace(value.ToString(), oldString, newString, RegexOptions.IgnoreCase);
  </code></pre>
  
  <p>result is now 61116. What would you suggest I do to query just the first x characters?</p>
  
  <p>Thanks</p>