diff --git a/lib/util.php b/lib/util.php
index d159c583ec..31a78a876a 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -452,9 +452,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
')'.
'(?:'.
'(?:\:\d+)?'. //:port
- '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path
- '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string
- '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment
+ '(?:/[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@]*)?'. // /path
+ '(?:\?[\pN\pL\$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@\/]*)?'. // ?query string
+ '(?:\#[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\@/\?\#]*)?'. // #fragment
')(?http://example.com/path/(foo)/bar'),
array('http://example.com/path/[foo]/bar',
- 'http://example.com/path/[foo]/bar'),
+ 'http://example.com/path/[foo]/bar'),
array('http://example.com/path/foo/(bar)',
'http://example.com/path/foo/(bar)'),
//Not a valid url - urls cannot contain unencoded square brackets
array('http://example.com/path/foo/[bar]',
- 'http://example.com/path/foo/[bar]'),
+ 'http://example.com/path/foo/[bar]'),
array('Hey, check out my cool site http://example.com okay?',
'Hey, check out my cool site http://example.com okay?'),
array('What about parens (e.g. http://example.com/path/foo/(bar))?',