请教高手 正则问题
请教高手,此段文本如何 正则$Str = '[[["爱","爱","ai"]],,"zh-CN"]'Msgbox(0, 0, $str)
$sR = StringRegExp($str, '\[\[\(.*)]\]', 3)
If @error = 0 Then MsgBox(0, 0, $sR)我需要正则出的结果是,里面的 爱 爱 ai
还有很多,我不知道如何找规律
如图:
Local $sR
$sText = '[[["爱","爱","ai"]],,"zh-CN"]'
$aReg1 = StringRegExp($sText, '\[\[\[(.+?)\]\]', 3)
$aReg2 = StringRegExp($aReg1, '"(.+?)"', 3)
For $i = 0 To UBound($aReg2) - 1
$sR &= $aReg2[$i] & ' '
Next
MsgBox(0, '', $sR) 也可以用正则替换$Str = '[[["爱","爱","ai"]],,"zh-CN"]'
MsgBox(0, 0, StringRegExpReplace($str, '\[{3}"(.)","(.)","([^"]+)".+', '$1 $2 $3')) 3Q,晚上回去看看效果!在公司不方便弄! Local $sR
$sText = '[[["爱","爱","ai"]],,"zh-CN"]'&@CRLF&'[[["爱","爱","ai"]],,"zh-CN"]'
$aReg = StringRegExp($sText, '"(.+?)"', 3)
For $i = 0 To UBound($aReg) - 1 Step 4
$sR &= $aReg[$i] & ' '&$aReg[$i+1] & ' '&$aReg[$i+2]&@CRLF
Next
MsgBox(0, '', $sR)
页:
[1]