using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions;namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Regex re = new Regex(@"\{1\}|\{3\}|\{5\}|\{6\}|\{10\}"); string str="{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}"; Console.WriteLine(re.Replace(str,"a")); } } }a{2}a{4}aa{7}{8}{9}a{11}{12}{13}{14}{15} Press any key to continue . . .
则替换后的字符串应该是a{2}a{4}aa{7}{8}{9}a{11}{12}{13}{14}{15}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Regex re = new Regex(@"\{1\}|\{3\}|\{5\}|\{6\}|\{10\}");
string str="{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}";
Console.WriteLine(re.Replace(str,"a"));
}
}
}a{2}a{4}aa{7}{8}{9}a{11}{12}{13}{14}{15}
Press any key to continue . . .