From 1fbcb8fddfdd37675de9d2d19e5220070002e722 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 29 Jan 2014 15:25:51 -0600
Subject: [PATCH] Fix clickable links which end in punctuation

---
 include/class.format.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.format.php b/include/class.format.php
index 31650f2c6..489b52219 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -314,10 +314,10 @@ class Format {
             function($match) use ($token) {
                 // Scan for things that look like URLs
                 $links = preg_replace_callback(
-                    '`(?<!>)(((f|ht)tp(s?)://|(?<!//)www\.)([a-zA-Z0-9_-]+(\.|/|$))+\S*)`',
+                    '`(?<!>)(((f|ht)tp(s?)://|(?<!//)www\.)([-+~%/.\w]+)(?:[-?#+=&;%@.\w]*)?)`',
                     function ($match) use ($token) {
                         if (in_array(substr($match[1], -1),
-                                array(',','.','?','!',':',';'))) {
+                                array('.','?','-',':',';'))) {
                             $match[7] = substr($match[1], -1);
                             $match[1] = substr($match[1], 0, strlen($match[1])-1);
                         }
-- 
GitLab