C# String replacement using Regex -


I currently have the code below to change the characters in a string, but now let me write the characters within the first x Change in this case 3) Leave the letters and the remaining string. Below I have 51115 in my example, but I need to change any 5 in the first 3 letters and I should end with 61115.

My current code:

  value = 51115; Old string = 5; NewString = 6; Results = Reggae Change (value.ToString (), Old String, New String, Regex Option. Ignorecase);  

The result is now 61116. What would you suggest that I just ask the first x characters?

Thanks

Specify not only fancy but also regex to that data Which should change it; Only send in the category of characters that can potentially be changed.

  Result = Regex Empty (value.ToString (.) Substring (0, X), Old String, NewString, Reggaeops.Ignorecase);  

Comments