为什么这个正则表达式会出错呢?
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace homework1._3{ class Program { static void isvalidzipcode(ref int a, out string b,out string c) { a = 11111; b ="-CCCC"; c = a + b; } static void Main(string[] args) { int val=0; string str1, str2; Boolean judge; judge="^\d{5}-([a-zA-Z]){4}$"; isvalidzipcode(ref val, out str1,out str2); Console.WriteLine("{0}", str2); Console.WriteLine(judge); Console.ReadLine(); } }}
Regex reg = new Regex(@"^\d{5}-([a-zA-Z]){4}$"); Match mm = reg.Match(str2);