[已解决]想分离出IDE硬件设备,求一正则,辛苦大家了!
本帖最后由 雨林GG 于 2011-6-24 19:45 编辑CdRomATAPI_DVD_D__DH16D5S____________________VC24____
DiskWDC_WD3200AAJS-22L7A0___________________01.03E01
CdRomNECVMWar_VMware_IDE_CDR10_______________1.00____
DiskVMware_Virtual_IDE_Hard_Drive___________00000001
如上字符串得到下面的结果,不知怎么写正则?
ATAPI DVD DDH16D5S
WDC WD3200AAJS-22L7A0
NECVMWar VMware IDE CDR10
VMware Virtual IDE Hard Drive
实在不好意思,麻烦各位了,先感谢您的帮助,感激之话无以形容,只能说声“谢谢”了! $s_Str="CdRomATAPI_DVD_D__DH16D5S____________________VC24____"&@crlf& _
"DiskWDC_WD3200AAJS-22L7A0___________________01.03E01"&@crlf& _
"CdRomNECVMWar_VMware_IDE_CDR10_______________1.00____"&@crlf& _
"DiskVMware_Virtual_IDE_Hard_Drive___________00000001"
;$a_Arr=StringRegExp($s_Str,"(?is)(?:cdrom|disk)(.*?)(?=_{4,})",4)
$o_VBSREGEXP=ObjCreate("vbscript.regexp")
With $o_VBSREGEXP
.global=1
.ignorecase=1
.multiline=1
.pattern="(?:cdrom|disk)(.*?)(?=_{4,})"
$Matches=.execute($s_Str)
EndWith
For $Match In $Matches
ConsoleWrite($Match.submatches(0)&@CRLF)
Next奇怪,正则测试器里可以显示出结果,但用程序时就是空的,只好用vbs正则啦。 回复 2# kevinch
谢谢了!
学习了?: 与?= ,俺再实践下~ 支持一些,其实我也正在学习写正则....
页:
[1]