Smart rules using Javascript with regular expressions

Don’t know about JavaScript but it does work with AppleScript over here, see this post