RaptorX wrote: ↑07 Apr 2024, 12:20
each part of the title match (ahk_class, ahk_exe) will have its own options so to speak, which is a bit strange as this would be an invalid
i)testing ahk_class i)AutoHotkey.* Regex string in any other circumstance.
Personally I think your perspective is a bit strange.
WinTitle is clearly not a regex string, but a
WinTitle string containing one or more criteria. The title and class name values can potentially be regex patterns (
plural), but it is obviously not one big pattern across the whole set of criteria, which includes special keywords. Each pattern matches against either the title or the class name, not some combination of e.g.
WinGetTitle(hwnd) " ahk_class " WinGetClass(hwnd).
i) in the middle of
WinTitle can look odd, but it should remind you that
WinTitle is a series of separate patterns and not one big RegEx. If you can be confused by
i)A ahk_class B, you can also be confused by
(?i)A ahk_class B not applying case sensitivity to B.
As an aside, options can be specified in a non-capturing group to better delineate the effective span of the option; e.g.
(?i:A) ahk_class (?i:B).