Index: follow.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/follow/follow.module,v
retrieving revision 1.5
diff -u -p -r1.5 follow.module
--- follow.module	30 Oct 2009 22:00:08 -0000	1.5
+++ follow.module	2 Nov 2009 18:41:44 -0000
@@ -384,6 +384,7 @@ function _follow_block_config_links($uid
   // Now add all the empty ones.
   foreach ($networks as $name => $title) {
     $link = new stdClass();
+    $link->name = $name;
     $form['follow_links'][$name] = _follow_links_form_link($link, $title);
   }
 
@@ -409,12 +409,13 @@ function _follow_links_form_link($link, 
     );
     $elements['weight'] = array(
       '#type' => 'weight',
-      '#default_value' => $links->weight,
+      '#default_value' => $link->weight,
     );
   }
   $elements['url'] = array(
     '#type' => 'textfield',
     '#default_value' => isset($link->url) ? $link->url : '',
+    '#network' => $link->name,
     '#element_validate' => array('follow_url_validate'),
   );
 
@@ -426,12 +427,46 @@ function _follow_links_form_link($link, 
  */
 function follow_url_validate($form) {
   $url = trim($form['#value']);
-  if($url && !preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i", $url)) {
+  $regex = follow_build_url_regex($form['#network']);
+  if($url && !preg_match($regex, $url)) {
     form_error($form, t('The specified url is invalid.'));
   }
 }
 
 /**
+ * Build a regex to validate the url based on a known service url.
+ */
+function follow_build_url_regex($network) {
+  static $url_map;
+
+  if (!isset($url_map)) {
+    $url_map = array(
+      'facebook'  => 'facebook.com',
+      'virb'      => 'virb.com',
+      'myspace'   => 'myspace.com',
+      'twitter'   => 'twitter.com',
+      'picasa'    => 'picasaweb.google.com',
+      'flickr'    => 'flickr.com',
+      'youtube'   => 'youtube.com',
+      'vimeo'     => 'vimeo.com',
+      'bliptv'    => 'blip.tv',
+      'lastfm'    => 'last.fm',
+      'linkedin'  => 'linkedin.com',
+      'delicious' => 'delicious.com',
+      'tumblr'    => 'tumblr.com',
+      'self'      => '',
+    );
+    drupal_alter('follow_networks_urls', $url_map);
+  }
+  $regex = '@^';
+  if (!empty($url_map[$network])) {
+    $regex .= 'https?://[a-z0-9\-_.]+' . str_replace('.', '\\.', $url_map[$network]);
+  }
+  $regex .= '[A-Za-z0-9./%&=\?\-_]+$@i';
+  return $regex;
+}
+
+/**
  * Submit handler for the follow_links_form.
  */
 function follow_links_form_submit($form, &$form_state) {

