TypeError thrown

preg_match() expects parameter 2 to be string, null given