grep() [v2.0]

Author: Titan Last Modified: 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 = "")

For more details of the functions's parameters and return value, please see it's source code.

Remarks

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

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=16164

License

The functions is an open source item under the Simplified BSD license. For details, please see titan-license.txt

Example

; #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%