回复 5# austere
我哪是什么大神,只是一个很菜的菜鸟~Dim $str, $string, $num, $ip1, $ip2, $nstr
$string = _
' <option value="142" >142.香港A型专用主机X10 (香港:21.209.11.20/10/121)</option>' & @CRLF & _
' <option value="142" >142.香港A型专用主机X10 (香港:21.209.11.51/25/5/68/9)</option>' & @CRLF & _
' <option value="142" >142.香港A型专用主机X10 (香港:21.209.11.89/16/75/87/64)</option>' & @CRLF & _
' <br>'
$num = StringSplit($string, @CR)
For $i = 1 To $num[0]
$ip1 = StringRegExp($num[$i], "\((.*?)\)", 3)
If Not @error Then
$str = ""
$ip2 = StringRegExp($ip1[0], ".*?:[\d+\.]+\.|/?(\d+)", 3)
For $k = 1 To UBound($ip2) - 1
$str &= $ip2[0] & $ip2[$k]
Next
EndIf
$num[$i] = StringRegExpReplace($num[$i], "\(.*?\)", "(" & $str & ")")
$nstr &= $num[$i] & @CR
Next
ConsoleWrite($nstr & @CRLF)
|