是这个意思?#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 325, 92, -1,-1)
$Combo1 = GUICtrlCreateCombo("", 16, 32, 177, 25)
$Button1 = GUICtrlCreateButton("Button1", 224, 24, 65, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
file()
EndSwitch
WEnd
Func file()
Local $Result
$Text = FileRead(@DesktopDir & '\1.txt') ;将需要匹配的字符串保存在脚本同目录下 Text.txt 文件里
MsgBox(0, '原字符串', $Text)
$Reg = StringRegExp($Text, '\d{3,4}\h+\d{3,4}\h+\d{1,2}\h+\d\d', 3)
For $i = 0 To UBound($Reg) - 1
$r=StringRegExpReplace($Reg[$i],'\h+',' ')
$Result &= $r & '|'
Next
MsgBox(0, '匹配结果', $Result)
GUICtrlSetData($Combo1,$Result)
;FileWrite(@DesktopDir & '\匹配结果.txt', $Result) ;匹配结果将会存放在脚本同目录下 匹配结果.txt 文件里
EndFunc ;==>file
|