in reply to Unicode error

Because

/$regex/
interprets the contents of $regex as a regular expression. What you want is:
/\Q$string\E/
which interprets the variable contents as a string (by backslashing any non-"word" characters the same as quotemeta does).

                - tye