According to RegExMatch docs, the function can
with ErrorLevel set like so:throw an exception on failure (not to be confused with "no match found")
The code below is designed to produce a compile error of the second type because the regex pattern is incomplete, and should cause the function to set ErrorLevel to an error string. However, ErrorLevel is set to "0", which is incorrect both according to the docs and to PCRE internals.Case 1: 0, which means that no error occurred.
Case 2: A string in the following form: Compile error N at offset M: description. In that string, N is the PCRE error number, M is the position of the offending character inside the regular expression, and description is the text describing the error.
Case 3: A negative number, (...)
Code: Select all
Try {
match_position := RegexMatch("blah", "(?:incomplete[")
}
Catch e {
MsgBox % ErrorLevel
}
Which confirms that the pattern cannot compile, being incomplete.Failed: missing terminating ] for character class at offset 14
Haven't checked the AHK code but I'm assuming there's a test slightly off in there. Thought I'd report. Thanks in advance for taking a look.