cast by target property to support regex function with number types

Fixes #3