in reply to Regex stored in a scalar

What is in $regex?

try

$line =~ /$regex/;

The way forward always starts with a minimal test.