为什么正则表达式不能判断呢?(续)
刚才的帖子结了,重新起个新的。
using System;using System.Collections.Generic;using System.Text.RegularExpressions;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; Regex reg = new Regex(@"^\d{5}-([a-zA-Z]){4}$"); isvalidzipcode(ref val, out str1,out str2); Match mm = reg.Match(str2); Console.WriteLine("{0}", str2); Console.WriteLine(mm); Console.ReadLine(); } }}
Console.WriteLine(mm.Success)