Index: wp-includes/comment.php
===================================================================
--- wp-includes/comment.php	(revision 12583)
+++ wp-includes/comment.php	(working copy)
@@ -45,8 +45,14 @@
 	if ( 1 == get_option('comment_moderation') )
 		return false; // If moderation is set to manual
 
-	if ( get_option('comment_max_links') && preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out) >= get_option('comment_max_links') )
-		return false; // Check # of external links
+	// Check # of external links
+	if ( get_option('comment_max_links') ) {
+		$links = preg_match_all("/<\s*a\s+(?:[^>]+\s+)?href\s*=[^>]+>/i", apply_filters('comment_text',$comment));
+		if ( 0 != strlen($url) )
+			$links += 1;
+		if ( $links >= get_option('comment_max_links') )
+			return false;
+	}
 
 	$mod_keys = trim(get_option('moderation_keys'));
 	if ( !empty($mod_keys) ) {
