diff --git a/link.inc b/link.inc
index f702751..b5787fb 100644
--- a/link.inc
+++ b/link.inc
@@ -323,8 +323,8 @@ function link_validate_url($text) {
 
   $directories = "(\/[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'!():;*@\[\]]*)*";
   // Yes, four backslashes == a single backslash.
-  $query = "(\/?\?([?a-z0-9". $LINK_ICHARS ."+_|\-\.\/\\\\%=&,$'():;*@\[\]{} ]*))";
-  $anchor = "(#[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'():;*@\[\]\/\?]*)";
+  $query = "(\/?\?([?a-z0-9". $LINK_ICHARS ."+_|\-\.\/\\\\%=&,$'!():;*@\[\]{} ]*))";
+  $anchor = "(#[a-z0-9". $LINK_ICHARS ."_\-\.~+%=&,$'!():;*@\[\]\/\?]*)";
 
   // The rest of the path for a standard URL.
   $end = $directories .'?'. $query .'?'. $anchor .'?'.'$/i';
diff --git a/tests/link.validate.test b/tests/link.validate.test
index b2a7f41..c402200 100644
--- a/tests/link.validate.test
+++ b/tests/link.validate.test
@@ -464,6 +464,7 @@ class LinkValidateUrlLight extends DrupalUnitTestCase {
       'http://www.cnn.com/video/#/video/politics/2008/12/09/intv.madeleine.albright.cnn',
       'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up',
       'http://www.example.com/blah/#this@that?',
+	  'http://example.com/#!/joebloggs',
     );
     // Test all of the protocols.
     $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'));
