111,120
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.IO;
using System.Data.SqlClient;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] str = new string[] { @"\\xxx\xx\xx\xx.doc",@"\\xxx\xx.doc",@"\\xxx\xx\xx\xx.dox" };
Regex re = new Regex(@"^(?i)\\\\[ 0-9a-z]+(\\[ 0-9a-z]+)+\.doc$");
foreach (string s in str)
{
if(re.Match(s).Success)
Console.WriteLine(re.Match(s).Value);
}
}
}
}