change when rule conditions to use regexes