in reply to passing a regex to a sub

Are you getting a script error or just unexpected results?