【已解决】正则提取有用信息
本帖最后由 xlcwxl 于 2013-4-6 21:56 编辑任务名 下次运行时间 状态
==================================== ======================== ===============
AutoIt 工具箱 21:13:00, 2013-4-8
SCITE编辑器 18:35:00, 2013-4-7
shutdown 13:57:00, 2013-4-7
XP优化模式设置 18:35:00, 2013-4-7
用正则真么提取以下信息:
AutoIt 工具箱
SCITE编辑器
shutdown
XP优化模式设置
看了半天的正则实在不懂了,请大家帮下忙,谢谢! #include <array.au3>
$str="任务名 下次运行时间 状态" &@crlf& _
"==================================== ======================== ===============" &@crlf& _
"AutoIt 工具箱 21:13:00, 2013-4-8 " &@crlf& _
"SCITE编辑器 18:35:00, 2013-4-7 " &@crlf& _
"shutdown 13:57:00, 2013-4-7 " &@crlf& _
"XP优化模式设置 18:35:00, 2013-4-7 "
$arr=StringRegExp($str,"([^\r\n]+)(?=[ \t]+\d{2}\:)",3)
If Not @error Then _ArrayDisplay($arr)这个试下 回复 2# kevinch
呵呵,谢谢,但是提取出来的后面还有很多空格 #include <array.au3>
$str="任务名 下次运行时间 状态" &@crlf& _
"==================================== ======================== ===============" &@crlf& _
"AutoIt 工具箱 21:13:00, 2013-4-8 " &@crlf& _
"SCITE编辑器 18:35:00, 2013-4-7 " &@crlf& _
"shutdown 13:57:00, 2013-4-7 " &@crlf& _
"XP优化模式设置 18:35:00, 2013-4-7 "
$arr=StringRegExp($str,"([^\r\n]+\S)(?=[ \t]+\d{2}\:)",3)
If Not @error Then _ArrayDisplay($arr)这样总行了吧 回复 4# kevinch
好了,谢谢! (.+)\s.+\d
页:
[1]