求正则表达式现有文件目录
C:\web\web.otel.com\19\tt32.jsp
D:\w\www.eotel.com\17\tt56.html
E:\eb\msm.eghtel.com\51\t56t.htm
H:\wweb\new.eghotel.cn\101\t789t.aspx用什么正则表达式才能匹配的取出目录中的网址部分呢?web.otel.com\19\tt32.jsp
www.eotel.com\17\tt56.html
msm.eghtel.com\51\t56t.htm
new.eghotel.cn\101\t789t.aspx
C:\web\web.otel.com\19\tt32.jsp
D:\w\www.eotel.com\17\tt56.html
E:\eb\msm.eghtel.com\51\t56t.htm
H:\wweb\new.eghotel.cn\101\t789t.aspx用什么正则表达式才能匹配的取出目录中的网址部分呢?web.otel.com\19\tt32.jsp
www.eotel.com\17\tt56.html
msm.eghtel.com\51\t56t.htm
new.eghotel.cn\101\t789t.aspx
解决方案 »
- sql读取 数据问题
- 在WINCE5.0平台上显示已有的图像
- 求助~!用C#编写一个程序:可以自由创建XML文档的应用程序~!
- [c++] short ISO6B_ReadLabelID(int *handle, void ** Buffer, int *nCounter);
- 请帮忙看看下面这段c#sql事务代码,它不能正确执行?
- c# CS1040: 预处理器指令必须作为一行的第一个非空白字符出现
- 使用域服务器中的服务,身份认证问题。
- 各位大神谁能帮帮忙
- 从头阅读帮助文档是否必要?
- .net框架的问题,都来看看吧
- c# 中怎样后台定义控件中文本的颜色?
- 我现在对C# 应该学点什么知识感觉很迷茫。。迷茫的我
string s = @"C:\web\web.otel.com\19\tt32.jsp";
Regex regex=new Regex(@"^[^\\]*\\[^\\]*\\(.+) *$");
Match match = regex.Match(s);
string result = match.Groups[1].Value;
MessageBox.Show(result);
{
Regex r = new Regex(@"(?<web>(\w+\.){2,}\w+\\\d+\\(\w+\.\w+))", RegexOptions.Compiled);
return r.Match(url).Result(@"${web}");
}
string pattern=@"(\w+\.){1,}.+";Regex r=new Regex(pattern,RegexOptions.IgnoreCase);
Match m=r.Match(str1);
Console.WriteLine(m.Value);
RegexOptions options = RegexOptions.None;
Regex regex = new Regex(@"(?<web>(\w+\.){2,}\w+\\\d+\\(\w+\.\w+))", options);
string input = @"H:\wweb\new.eghotel.cn\101\t789t.aspx"; // Check for match
bool isMatch = regex.IsMatch(input);
if( isMatch )
{
// TODO: Do something with result
System.Windows.Forms.MessageBox.Show(input, "IsMatch");
} // Get match
Match match = regex.Match(input);
if( match != null )
{
// TODO: Do something with result
System.Windows.Forms.MessageBox.Show(match.Value, "Match");
}
string a=Regex.Replace(@"C:\web\web.otel.com\19\tt32.jsp",@"\w:\\|\w+\\","");