I haven't read the whole thread, but I'm pretty sure you both have the wrong expectations, possibly because the documentation is inaccurate.
SetTitleMatchMode wrote:Changes WinTitle, WinText, ExcludeTitle, and ExcludeText to be regular expressions.
Those parameters aren't regular expressions; rather, the title/text components of those parameters are.
SetTitleMatchMode wrote:RegEx also applies to ahk_class;
It only mentions ahk_class, not ahk_exe or any other keyword. However, on the WinTitle page ...
If the RegEx title matching mode is active, ahk_exe accepts a regular expression.
As it implies, the title, class and process path
each take a regex pattern. For example,
i)xxx ahk_class i)yyy is the correct way to specify case-insensitivity for each pattern.
sinkfaze wrote:Everything in the WinTitle field is the string upon which regex acts
No. That doesn't even make sense. The WinTitle field sets multiple criteria, and is what contains the regex pattern itself, not the string against which the pattern is matched. For the pattern to match over all criteria, AutoHotkey would first have to determine the pattern (
%title% ahk_exe %process_name_or_path%) and then build a string matching that pattern for each and every window, and match that against the regex pattern. That would be a lot more work, and not particularly intuitive.
^ahk_id 0x7903fc$ and similar match because:
- the WinTitle component ends at the first ahk_ keyword,
- ^ (which is the entire title regex pattern) matches any string at all, and
- For ahk_class and ahk_exe, $ matches at the end of the class/process path.
- For numeric criteria such as ahk_pid, $ and other trailing non-numeric characters are ignored by whatever string->int conversion function is used (as is common for the C runtime functions).
Note that
^ahk_class someclass$ will also match
xxxsomeclass, because the circumflex (^) is the complete
title regex, not part of the class regex.
Leli196 wrote:; this does not work at all, no match
WinGet, window1_ID, ID, ahk_exe i)^SomeProg.exe$
In the RegEx mode, ahk_exe is matched against
the full path of the process only. If you want to match the process name, you can just precede it with a slash (which must be escaped in RegEx mode).