Your regex is not really well constructed. You can use the /i flag to make it case insensitive. Also, your regex will match www........... followed by many dots and http..... followed by many characters after.
This one will only match http:// followed by domain names. That goes the same for www. followed by domain names:
if ($regex($1-,/(http:\/\/\w+|www\.\w+)/i))