grep() [v2.0]

作者: Titan 最近更新时间: nonexistent


Sets the output variable to all the entire or specified subpattern matches and returns their offsets within the haystack.

grep(h, n, ByRef v, s = 1, e = 0, d = "")

关于函数的参数和返回值, 请参阅其源码.

备注

This function lacks an external library. Look source for how to use.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=16164

许可

此函数(集)是基于 Simplified BSD 许可的开源项目. 想了解许可详情, 请参见 titan-license.txt

示例

; #Include grep.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

FileRead, haystack, %A_ScriptName%
regex := "%.*?%"
pos := grep(haystack, regex, outputVar, 1, 0, ", ")

MsgBox %pos%
MsgBox %outputVar%