deepForEach, toRegExp, toFunction functions