> $regex(%regex,$null)

Incorrect $regex() syntax. Try $regex($null,%regex)


Well. At least I won lunch.
Good philosophy, see good in bad, I like!