### Eclipse Workspace Patch 1.0
#P Drupal7
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.336
diff -u -r1.336 filter.module
--- modules/filter/filter.module	1 Aug 2010 19:50:33 -0000	1.336
+++ modules/filter/filter.module	8 Aug 2010 12:59:49 -0000
@@ -1301,13 +1301,12 @@
   $text = ' ' . $text . ' ';
 
   // Match absolute URLs.
-  $text = preg_replace_callback("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])((http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", '_filter_url_parse_full_links', $text);
+  $text = preg_replace_callback('`(?<=[\s(>])((http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))(?=[.,?!\s)<])`i', '_filter_url_parse_full_links', $text);
 
   // Match e-mail addresses.
-  $text = preg_replace("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", '\1<a href="mailto:\2">\2</a>\3', $text);
-
+  $text = preg_replace("`(?<=[\s(>])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})(?=[.,?!\s)<])`i", '<a href="mailto:\1">\1</a>', $text);
   // Match www domains/addresses.
-  $text = preg_replace_callback("`(<p>|<li>|[ \n\r\t\(])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+~#\&=/;-])([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", '_filter_url_parse_partial_links', $text);
+  $text = preg_replace_callback("`(?<=[\s(>])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+~#\&=/;-])(?=[.,?!\s)<])`i", '_filter_url_parse_partial_links', $text);
   $text = substr($text, 1, -1);
 
   return $text;
@@ -1317,20 +1316,20 @@
  * Make links out of absolute URLs.
  */
 function _filter_url_parse_full_links($match) {
-  $match[2] = decode_entities($match[2]);
-  $caption = check_plain(_filter_url_trim($match[2]));
-  $match[2] = check_url($match[2]);
-  return $match[1] . '<a href="' . $match[2] . '">' . $caption . '</a>' . $match[5];
+  $match[1] = decode_entities($match[1]);
+  $caption = check_plain(_filter_url_trim($match[1]));
+  $match[1] = check_url($match[1]);
+  return '<a href="' . $match[1] . '">' . $caption . '</a>';
 }
 
 /**
  * Make links out of domain names starting with "www."
  */
 function _filter_url_parse_partial_links($match) {
-  $match[2] = decode_entities($match[2]);
-  $caption = check_plain(_filter_url_trim($match[2]));
-  $match[2] = check_plain($match[2]);
-  return $match[1] . '<a href="http://' . $match[2] . '">' . $caption . '</a>' . $match[3];
+  $match[1] = decode_entities($match[1]);
+  $caption = check_plain(_filter_url_trim($match[1]));
+  $match[1] = check_plain($match[1]);
+  return '<a href="http://' . $match[1] . '">' . $caption . '</a>';
 }
 
 /**
