Sorry, cannot do this. It only recognizes ~ at start.
But... You can try =(expr) as caption list .. So for expr use win.matches(A) and not win.matches(B); see following for x0 usage
You can use a normal expression to match by setting the whole match string to
=(expression)
You cannot use a command separated list: =(expression) must be the whole matcher. You can use the variable x0 in the expression to get the handle of the window to be matched. For example
=(win.handlefrompoint(xmouse.ymouse).class()=="ToolBar32" && win.matches (x0, "=notepad,&,*xxx*"))
checks the class of the child window under the mouse and also ensures the main window being matches (with handle in x0) matches the specified string