Enabling regular expressions to get an arbitrary object