寻求一个正则表达式,请大家帮忙啦。

ssjywhr 2011-09-29 10:12:30
我有一文本文件abc.txt,里面的内容如下:
ZB-8640_3 B.11.31 U ia64 (tb)
login:
Password:
Last successful login: Thu Sep 29 09:43:06 EAT 2011 ::ffff:110.31.84.29
Last authentication failure: Thu Sep 29 09:41:46 EAT 2011 ::ffff:230.56.190.89
Please wait...checking for disk quotas
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993 The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.
Confidential computer software. Valid license from HP required for
possession, use or copying. Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.
You have mail.

ZB-8640_3-/opt/iv>cd /opt/iv/UnicomNPI/data/CPM/PM
ZB-8640_3-/opt/iv/UnicomNPI/data/Yunnan/PM> ls -lrt *2011092906*
-rw-r--r-- 1 iv interbus 510186 9月29日 08:31 24_PM_20110929050000-20110929060000_0.xml
-rw-r--r-- 1 iv interbus 511146 9月29日 09:31 24_PM_20110929060000-20110929070000_0.xml

现在我要用C#程序来取出里面的24_PM_20110929050000-20110929060000_0.xml,请问要怎么弄啊?
谢谢大家啦。
...全文
61 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangwenquan123 2011-09-29
  • 打赏
  • 举报
回复
            string str = File.ReadAllText(@"E:\1.txt", Encoding.GetEncoding("gb2312"));
Regex reg = new Regex(@"\d+_[AP]M_\d+-\d+_\d+\.xml");
Console.WriteLine(reg.Match(str).Value);
诺维斯基 2011-09-29
  • 打赏
  • 举报
回复
24_PM_20110929050000-20110929060000_0.xml

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧