Any idea why this function doesn't work...

PHP Code:
function ValidateURL($url)
    {
        if(!
preg_match('/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?'$url))
        {
            return 
false;
        } 
        else 
        {
            return 
true;
        }

    } 
I get the following error:

Warning: preg_match() [function.preg-match]: Unknown modifier '~' in /Applications/MAMP/htdocs/domain.co.uk/public_html/classes/user.class.php on line 556