我正在尝试创建正则表达式来读取以下语句
查找所有可能在 2015 年 7 月 2 日星期四 09:30:00 EST 在监视器 AAA-AAA_NameOf Place 上运行的计划。
到目前为止完成::
string name = @"^Finding all possible schedules that could run
?<Listname>(\w{3}\-\w{3}\_)+"; //got kinda lost here
Regex reg = new Regex(name);
我想要什么?
我想将此 AAA-AAA_NameOf Place 作为输出并将其分配到列表中。以及声明中的日期每次都可能不同。
请您参考如下方法:
给你:
var data = "Finding all possible schedules that could run at Thu Jul 02 09:30:00 EST 2015 on monitor AAA-AAA_NameOf Place";
string namePattern = @"(?<=monitor\s).*$";
Console.WriteLine(Regex.Match(data, namePattern).Value);
希望这对您有所帮助。
