diff --git a/invisimail.module b/invisimail.module
index c897236..e250e5a 100644
--- a/invisimail.module
+++ b/invisimail.module
@@ -127,9 +127,9 @@ function invisimail($string, $format) {
   // The final pattern. We deal with these as an entire group because invisimail
   // allows options that require us to deal with both an href and its text
   // in relation to one another.
-  $pattern = "@(?:(<a [^>]*href=['\"](mailto:$mail)['\"][^>]*>)?((?".">(?<!mailto:))$mail))|(<a [^>]*href=['\"](mailto:$mail)['\"][^>]*>(.*?)</a>)@$modifiers";
-  $pattern_diff_link_text = "@(<a [^>]*href=['\"](mailto:$mail)['\"][^>]*>(.*?)</a>)@$modifiers";
-  $pattern_same_link_text = "@(?:(<a [^>]*href=['\"](mailto:$mail)['\"][^>]*>)?((?".">(?<!mailto:))$mail))@$modifiers";
+  $pattern = "@(?:(<a [^>]*href=['\"](mailto:$mail)['\"\?][^>]*>)?((?".">(?<!mailto:))$mail))|(<a [^>]*href=['\"](mailto:$mail)['\"\?][^>]*>(.*?)</a>)@$modifiers";
+  $pattern_diff_link_text = "@(<a [^>]*href=['\"](mailto:$mail)['\"\?][^>]*>(.*?)</a>)@$modifiers";
+  $pattern_same_link_text = "@(?:(<a [^>]*href=['\"](mailto:$mail)['\"\?][^>]*>)?((?".">(?<!mailto:))$mail))@$modifiers";
 
   // The callback needs to know about the filter we're using, but there's no way
   // to hand off that variable through preg_replace_callback. So we set it as a
