向高手求教,如何正则这段代码
本帖最后由 316428696 于 2010-2-5 11:50 编辑{"sentences":[{"trans":"黑","orig":"黑","translit":"hēi"}],"src":"en"}
{"sentences":[{"trans":"Black","orig":"黑","translit":""}],"dict":[{"pos":"名词","terms":["black","blackness","carcajou","dark","nigritude"]},{"pos":"形容词","terms":["black","dark"]},{"pos":"副词","terms":["darkly"]}],"src":"en"}
{"sentences":[{"trans":"黒","orig":"黑","translit":"kuro "}],"src":"en"}
{"sentences":[{"trans":"嘿嘿","orig":"黑","translit":"geomjeong"}],"src":"en"}取出中文 回复 1# 316428696 #include <Array.au3>
$Str = _
'{"sentences":[{"trans":"黑","orig":"黑","translit":"hēi"}],"src":"en"}' & @CRLF & _
'{"sentences":[{"trans":"Black","orig":"黑","translit":""}],"dict":[{"pos":"名词","terms":["black","blackness","carcajou","dark","nigritude"]},{"pos":"形容词","terms":["black","dark"]},{"pos":"副词","terms":["darkly"]}],"src":"en"}' & @CRLF & _
'{"sentences":[{"trans":"黒","orig":"黑","translit":"kuro "}],"src":"en"}' & @CRLF & _
'{"sentences":[{"trans":"嘿嘿","orig":"黑","translit":"geomjeong"}],"src":"en"}'
Msgbox(0, '源', $str)
$sR = StringRegExp($str, '[^\x00-\xff]+', 3)
_ArrayDisplay($sR, '中文字符') afan前辈果然是正则高手哦!厉害!
解决LZ问题的关键其实就是 [^\x00-\xff]+这个表达式!(匹配中文) afan前辈果然是正则高手哦!厉害!
解决LZ问题的关键其实就是 [^\x00-\xff]+这个表达式!(匹配中文)
水木子 发表于 2010-2-4 23:00 http://www.autoitx.com/images/common/back.gif
正则之神!出现了,不过我还是采用截取字符串的办法搞定了! 正则之神!出现了,不过我还是采用截取字符串的办法搞定了!
316428696 发表于 2010-2-5 00:16 http://www.autoitx.com/images/common/back.gif
神没来,来的是菜鸟……
p.s, 不知道lz的用途,可能这里正则并不合适吧…… 回复 5# afan
嗯,
很对!
页:
[1]