Php – Warning: preg_match() [function.preg-match]: No ending delimiter ‘^’ found

error handlingPHPpreg-matchvalidationWordpress

I am trying to resolve an issue I have been having with one of my wordpress plugins.

This is line 666

function isUrl($url)
{
    return preg_match("^http:\/\/[-0-9a-z\._]+.*$/i", trim( $url ));
}

What are your inputs on how I can resolve this warning? It's quite irritating. I can't figure it out and I've tried, researched everything!

Best Answer

/ is missing. preg_match('/pattern/',$string);

preg_match("/^http:\/\/[-0-9a-z\._]+.*$/i", trim( $url ));