widget/reply: emphasis formatting over sentences
[minimedit.git] / upload.inc.php
index 86af6049dd49a6fff720deb77c7a1d76afc91dee..0ee432bc538a8f82f0fe5d1ea135b4524d948b7d 100644 (file)
@@ -58,8 +58,8 @@ function messagehtml($input)
                "/\r\n?/" => "\n",        # unix newlines
                "/  +\n/" => "<br />",    # trailing spaces for hard line break
                "/\n/"    => "</p>\n<p>", # newlines start paragraphs
-               '/\b_(\w+)_\b/'   => '<em>$1</em>',         # italic
-               '/\b\*(\w+)\*\b/' => '<strong>$1</strong>', # bold
+               '/_(?<!\w_)(.+?)_(?!\w)/'      => '<em>$1</em>',         # italic
+               '/\*(?<!\w\*)(.+?)\*(?!\w)/'   => '<strong>$1</strong>', # bold
        ];
        $html = preg_replace(array_keys($markup), array_values($markup), htmlspecialchars($input));
        return "<p>$html</p>";