[已解决]如何用正则提取指定字符?
本帖最后由 pdp320921 于 2011-4-12 12:32 编辑Interface name : Wireless Network Connection
There are 6 networks currently visible.
SSID 1 : 802.1_b
Network type : Infrastructure
Authentication : WPA-Personal
Encryption : TKIP
BSSID 1 : 00:0d:bc:68:24:e8
Signal : 45%
Radio type : 802.11b
Channel : 11
Basic rates (Mbps) : 1 2 5.5 11
SSID 2 : WLAN14
Network type : Infrastructure
Authentication : Open
Encryption : None
BSSID 1 : 00:26:0b:15:48:00
Signal : 44%
Radio type : 802.11g
Channel : 4
Basic rates (Mbps) : 11
Other rates (Mbps) : 12 18 24 36 48 54
BSSID 2 : 00:20:a6:4f:2c:f5
Signal : 44%
Radio type : 802.11g
Channel : 6
Basic rates (Mbps) : 1 2 5.5 11
Other rates (Mbps) : 6 9 12 18 24 36 48 54
SSID 3 : VISITOR
Network type : Infrastructure
Authentication : Open
Encryption : None
BSSID 1 : 00:26:0b:15:48:01
Signal : 44%
Radio type : 802.11g
Channel : 4
Basic rates (Mbps) : 11
Other rates (Mbps) : 12 18 24 36 48 54
SSID 4 : Guest
Network type : Infrastructure
Authentication : Open
Encryption : WEP
BSSID 1 : 00:26:0b:15:48:02
Signal : 45%
Radio type : 802.11g
Channel : 4
Basic rates (Mbps) : 11
Other rates (Mbps) : 12 18 24 36 48 54
SSID 5 : sbr3.29
Network type : Infrastructure
Authentication : Open
Encryption : WEP
BSSID 1 : 00:26:cb:94:d7:10
Signal : 45%
Radio type : 802.11g
Channel : 9
Basic rates (Mbps) : 1 2 5.5 11
Other rates (Mbps) : 6 9 12 18 24 36 48 54
SSID 6 : VISITOR
Network type : Infrastructure
Authentication : Open
Encryption : WEP
BSSID 1 : 00:20:a6:4f:2c:f5
Signal : 46%
Radio type : 802.11g
Channel : 6
Basic rates (Mbps) : 1 2 5.5 11
Other rates (Mbps) : 6 9 12 18 24 36 48 54
如何运用正则提取SSID返回像下面的数组?
802.1_b
WLAN14
VISITOR
Guest
..........
.........
同上如何运用正则提取Network type,Authentication,Encryption 返回如上面的数组?
求助大虾们~~
PS:首行是空行.上述文本信息框架就那样,顺序有时会变 本帖最后由 kevinch 于 2011-4-8 14:51 编辑
第一个:#include <array.au3>
$h_File=FileOpen(@ScriptDir&"\5.txt",0)
$s_Str=FileRead($h_File)
FileClose($h_File)
$a_Arr=StringRegExp($s_Str,"(?:SSID\s?\d+\s?:\s*)([\w.]+)",3)
_ArrayDisplay($a_Arr)第二个:#include <array.au3>
$h_File=FileOpen(@ScriptDir&"\5.txt",0)
$s_Str=FileRead($h_File)
FileClose($h_File)
$a_Arr=StringRegExp($s_Str,"(?:Network type\s*:\s*)([\w.]+)",3)
_ArrayDisplay($a_Arr)第二个的关键字可以替换为其他几个 回复 2# kevinch
非常感谢楼上的解答.
不过使用StringRegExp($line,"(?:Signal\s*:\s*)([\w.]+)",3)时百分号丢了~
怎么添加上呢? StringRegExp($line,"(?:Signal\s*:\s*)([\w.]+\%)",3)OK了~ 这个不太会 跟高手学习了呵呵 本帖最后由 pdp320921 于 2011-4-9 13:17 编辑
请看上图,请求高手能帮下忙,
如何能做到当BSSID这一列出现非1的数字时,能实现跟上面最近的1的行合并?
如:
上图合并后BSSID这一列成为
BSSID
1,2
1
1
1
1
1
PS:图片中是ListView 大虾们,请帮下忙啊,在线等啊~~
页:
[1]