Regular Expression

~((?:https?|ftp)://)?[\w-]+(?>\.[\w-]+)+(?>[.,]*(?>[\w@?^=%/\~+#;-]+|&(?:amp;)?)+)*~