[已解决]正则表达问题
本帖最后由 lxsky 于 2013-5-24 15:17 编辑求救,大侠快来#include <Array.au3>
Dim $Data = ' _Callback( '& @CRLF & _
' {"data":{ ' & @CRLF & _
' "title_num":30, ' & @CRLF & _
' "titlelist":[{"id":1368757945, ' & @CRLF & _
' "pubtime":1368757945, ' & @CRLF & _
' "reply":汉化,} ' & @CRLF & _
' {"id":1368704430, ' & @CRLF & _
' "pubtime":1368704430, ' & @CRLF & _
' "reply"":明天,} ' & @CRLF & _
' {"id":1368704380, ' & @CRLF & _
' "pubtime"":1368704380, ' & @CRLF & _
' "reply":舔舔,} ' & @CRLF & _
' ] ' & @CRLF & _
' }} ' & @CRLF & _
' ); '
MsgBox (0,"",$Data)想得到如下的数组:
$Array
1368757945 1368757945 汉化
1368704430 1368704430 明天
1368704380 1368704380 舔舔
前面好像发错到已解决里面了,麻烦管理员删除吧http://www.autoitx.com/thread-38594-1-1.html #include <Array.au3>
Local $Str = _
' _Callback( ' & @CRLF & _
' {"data":{ ' & @CRLF & _
' "title_num":30, ' & @CRLF & _
' "titlelist":[{"id":1368757945, ' & @CRLF & _
' "pubtime":1368757945, ' & @CRLF & _
' "reply":汉化,} ' & @CRLF & _
' {"id":1368704430, ' & @CRLF & _
' "pubtime":1368704430, ' & @CRLF & _
' "reply"":明天,} ' & @CRLF & _
' {"id":1368704380, ' & @CRLF & _
' "pubtime"":1368704380, ' & @CRLF & _
' "reply":舔舔,} '
;;MsgBox(0, '原字符串', $Str)
Local $aSR = StringRegExp($str, '(?i)"id":(\d+)[^:]+:(\d+)[^:]+:(.+),', 3)
_ArrayDisplay($aSR, UBound($aSR))组织成二维数组自己搞 本帖最后由 lxsky 于 2013-5-24 15:17 编辑
谢谢了,通过你的方法初步了解了正则式
页:
[1]