I have the following code:
using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var r = new Regex(@"_(\d+)$");
string new_name = "asdf_1";
new_name = r.Replace(new_name, match =>
{
Console.WriteLine(match.Value);
return match.Value;
//return (Convert.ToUInt32(match.Value) + 1).ToString();
});
//Console.WriteLine(new_name);
}
}
I expect match.Value
to be 1
, but it is printing as _1
. What am I doing wrong?