diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 0c0867a12662b80a1d435f4c4d9b6be7ea4b49f7..24c64bd55bbfe3a8598f5443995e1dbf5ddd4107 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -1392,7 +1392,7 @@ function _filter_url($text, $filter) {
   $domain = '(?:[A-Za-z0-9._+-]+\.)?[A-Za-z]{2,64}\b';
   $ip = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}';
   $auth = '[a-zA-Z0-9:%_+*~#?&=.,/;-]+@';
-  $trail = '[a-zA-Z0-9:%_+*~#&\[\]=/;?\.,-]*[a-zA-Z0-9:%_+*~#&\[\]=/;-]';
+  $trail = '[a-zA-Z0-9:%_+*~#&\[\]=/;?!\.,-]*[a-zA-Z0-9:%_+*~#&\[\]=/;-]';
 
   // Prepare pattern for optional trailing punctuation.
   // Even these characters could have a valid meaning for the URL, such usage is
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index b96c24042a0727a9df049ae8b37eec4b0096325b..e878477c153e725f9cd8e9b8f9140a44e88bc64c 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -1176,10 +1176,11 @@ person@example.com or mailto:person2@example.com
         '<a href="mailto:person@example.com">person@example.com</a>' => TRUE,
         '<a href="mailto:person2@example.com">mailto:person2@example.com</a>' => TRUE,
       ),
-      // URI parts.
+      // URI parts and special characters.
       '
 http://trailingslash.com/ or www.trailingslash.com/
 http://host.com/some/path?query=foo&bar[baz]=beer#fragment or www.host.com/some/path?query=foo&bar[baz]=beer#fragment
+http://twitter.com/#!/example/status/22376963142324226
 ftp://user:pass@ftp.example.com/~home/dir1
 sftp://user@nonstandardport:222/dir
 ssh://192.168.0.100/srv/git/drupal.git
@@ -1188,6 +1189,7 @@ ssh://192.168.0.100/srv/git/drupal.git
         '<a href="http://www.trailingslash.com/">www.trailingslash.com/</a>' => TRUE,
         '<a href="http://host.com/some/path?query=foo&amp;bar[baz]=beer#fragment">http://host.com/some/path?query=foo&amp;bar[baz]=beer#fragment</a>' => TRUE,
         '<a href="http://www.host.com/some/path?query=foo&amp;bar[baz]=beer#fragment">www.host.com/some/path?query=foo&amp;bar[baz]=beer#fragment</a>' => TRUE,
+        '<a href="http://twitter.com/#!/example/status/22376963142324226">http://twitter.com/#!/example/status/22376963142324226</a>' => TRUE,
         '<a href="ftp://user:pass@ftp.example.com/~home/dir1">ftp://user:pass@ftp.example.com/~home/dir1</a>' => TRUE,
         '<a href="sftp://user@nonstandardport:222/dir">sftp://user@nonstandardport:222/dir</a>' => TRUE,
         '<a href="ssh://192.168.0.100/srv/git/drupal.git">ssh://192.168.0.100/srv/git/drupal.git</a>' => TRUE,