diff --git a/include/class.format.php b/include/class.format.php
index 31650f2c6f9a77d5839d061585414d717ac0fb55..ef56399d60424b871e6dab8eed87587a1ac7013b 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -385,7 +385,7 @@ class Format {
     }
 
     function viewableImages($html, $script='image.php') {
-        return preg_replace_callback('/"cid:([\\w.-]{32})"/',
+        return preg_replace_callback('/"cid:([\w.-_]{32})"/',
         function($match) use ($script) {
             $hash = $match[1];
             if (!($file = AttachmentFile::lookup($hash)))