找回密码
 加入
搜索
查看: 1819|回复: 2

[效率算法] 求助一正则的写法(已解决)

[复制链接]
发表于 2012-8-19 15:01:33 | 显示全部楼层 |阅读模式
本帖最后由 tubaba 于 2012-8-19 22:11 编辑

想用正则来提取csv文件每一项的值,如
"8",",","怡","401001","15008","255.255.255.49","3402",""",""","20120621"

要求提取后为

头很疼,应该如何写?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-8-19 15:56:33 | 显示全部楼层
#include <array.au3>
$str='"8",",","怡","401001","15008","255.255.255.49","3402",""",""","20120621"'
$regexp=ObjCreate("vbscript.regexp")
With $regexp
        .global=1
        .pattern='"(("*)([^"]*)\2)"'
        If .test($str) Then
                $arr=.execute($str)
                Dim $result[$arr.count],$n
                $n=0
                For $match In $arr
                        $result[$n]=StringReplace($match.submatches(0),'""','"')
                        $n+=1
                Next
                _ArrayDisplay($result)
        EndIf
EndWith
$regexp=0
 楼主| 发表于 2012-8-19 21:26:50 | 显示全部楼层
本帖最后由 tubaba 于 2012-8-19 22:10 编辑

谢谢,果然高手如林啊,~~,如果只用正则和sringreplace不知道该如何实现

找到答案了,http://www.autoitx.com/thread-29704-2-1.html
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-21 05:11 , Processed in 0.078752 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表