diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index eb3bee87..e086c448 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -85,7 +85,7 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null)
function prepare_html_message($text)
{
$escaped_text = safe_htmlspecialchars($text);
- $text_w_links = preg_replace('/(?i)(http|https|ftp):\/\/\S*/', '$0', $escaped_text);
+ $text_w_links = preg_replace('/(https?|ftp):\/\/\S*/i', '$0', $escaped_text);
$multiline = str_replace("\n", "
", $text_w_links);
return $multiline;
}