Forums list
New topics
Topics list
Search
Help
Login


Topic: «How to create a rule for windows, whose captions do NOT contain certain substring » on forum: Window Rules, or Tips and Tricks   Views: 2643
 
Bogdan Polishchuk
Administrator
 
Posts: 4064
Joined: 04/04/2012
Posted: 01/29/2019 16:25:35
 
 
Hi everyone,

If you need to create an exclusion or specific settings for a window that doesn't contain certain substring in the caption, you can use the negation (logical NOT) regular expression in the caption criterion. Switch the Caption criterion mode to "Regular expression" and then use one of the "logical NOT" expressions in the Caption field. Here's how the expressions look for the "test" substring example:

1)
^((?!test).)*$

2)
Here's a variation that looks more complex, but works a bit faster:
^(?(?=.*?test)(?#fail)|.*)$

Please note that both these expressions are case sensitive, thus the rule won't be applied to a window with the caption "This is test", but it will be applied to a window with the caption "This is Test".

To disable case sensitivity of these expressions you should add (?i) in the beginning:
(?i)^((?!test).)*$
(?i)^(?(?=.*?test)(?#fail)|.*)$
 
Top


User(s) reading this topic
Number of guests: 1, registered members: 0, in total hidden: 0


Forums list
New topics
Topics list
Search
Help
Login