找回密码
 加入
搜索
查看: 2101|回复: 4

[AU3基础] 三段字符,正则表达式,如何提取!

[复制链接]
发表于 2013-3-29 14:18:29 | 显示全部楼层 |阅读模式
一个iP.txt文件内容如下:
2577180630----abde6760----175.43.12.215
2253543661----abde6760----175.43.12.202
1423265642----abde6760----175.43.12.202
2260235438----abde6760----175.43.12.122
1541165746----abde6760----175.43.12.202
2486652536----abde6760----175.43.12.202
源码如下:
#include <Array.au3>
#include <Inet.au3>
#Include <File.au3>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;清除文件夹;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Script Start - Add your code below here

; Global function parameters
Local $PublicIP = _GetIP();获取外网IP
$ipfilere = FileRead(@ScriptDir&"\IP.txt")
$ipqqdan = StringRegExp($ipfilere, '\d+--+[^-\r\n]+', 3)

For $t = 0 To UBound($ipqqdan) - 1
        MsgBox(4096, "行数", "共有行数为: " & UBound($ipqqdan) )
        MsgBox(4096, "QQ号码", "QQ12号码为: " & $ipqqdan[$t] )
        $ipqq = StringRegExp($ipqqdan[$t], '[^-]+', 3)
        MsgBox(4096, "QQ号码", "QQ号码为: " & $ipqq[0] )
        MsgBox(4096, "QQ密码", "IP为: " & $ipqq[1] )
        ;MsgBox(4096, "QQ密码", "IP为: " & $ipqq[2] )
       
Next

上段代码只能提取前两段数据,怎么样改成提取三段数据。
 楼主| 发表于 2013-3-29 14:19:54 | 显示全部楼层
#include <Array.au3>
#include <Inet.au3>
#Include <File.au3>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;清除文件夹;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Script Start - Add your code below here

; Global function parameters
Local $PublicIP = _GetIP();获取外网IP
$ipfilere = FileRead(@ScriptDir&"\IP.txt")
$ipqqdan = StringRegExp($ipfilere, '\d+--+[^-\r\n]+', 3)

For $t = 0 To UBound($ipqqdan) - 1
        MsgBox(4096, "QQ号码", "QQ11号码为: " & UBound($ipqqdan) )
        MsgBox(4096, "QQ号码", "QQ12号码为: " & $ipqqdan[$t] )
        $ipqq = StringRegExp($ipqqdan[$t], '[^-]+', 3)
        MsgBox(4096, "QQ号码", "QQ号码为: " & $ipqq[0] )
        MsgBox(4096, "QQ密码", "IP为: " & $ipqq[1] )
        ;MsgBox(4096, "QQ密码", "IP为: " & $ipqq[2] )
        
Next
发表于 2013-3-30 17:25:45 | 显示全部楼层
回复 1# manbutianya

$ipqqdan = StringRegExp($ipfilere, '(?m)(\d+)-+(\w+)-+(.+)', 3)
_arraydisplay($ipqqdan)
发表于 2013-3-30 23:01:44 | 显示全部楼层
额滴个神呀,这样的问题描述你们居然看懂了。。。
发表于 2013-3-30 23:51:46 | 显示全部楼层
[^-\n\r]+

评分

参与人数 1金钱 +30 收起 理由
xms77 + 30 真简洁明了啊!

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-19 18:02 , Processed in 0.084291 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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