Allow strings and regular expressions in connect/disconnect functions.