本帖最后由 lsq726 于 2009-6-13 15:56 编辑 #include <INet.au3>
$test1 = "<test><![TEST[测试]]></TEST>"
$nOffset = 1
While 1
;$array = StringRegExp($test1, '<test><!\[TEST\[[^\s]*\]\]></TEST>', 1, $nOffset)
$array = StringRegExp($test1, '(?:<test><!\[TEST\[)[^\s]*(?:\]\]></TEST>)', 1, $nOffset)
If @error = 0 Then
$nOffset = @extended
Else
ExitLoop
EndIf
for $i = 0 to UBound($array) - 1
msgbox(0, "RegExp 测试选项 1 - " & $i, $array[$i])
Next
WEnd
2个代码获取的效果是一样
$array = StringRegExp($test1, '<test><!\[TEST\[[^\s]*\]\]></TEST>', 1, $nOffset)
$array = StringRegExp($test1, '(?:<test><!\[TEST\[)[^\s]*(?:\]\]></TEST>)', 1, $nOffset)
想只获取“测试”字符串 该怎么弄? |