diff --git a/lib/util.php b/lib/util.php
index 8a56be55d5..edc08d4c12 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -421,7 +421,7 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
'|'.
'(?:(?:mailto|aim|tel|xmpp):)'.
')'.
- '(?:[\pN\pL\-\_\+]+(?::[\pN\pL\-\_\+]+)?\@)?'. //user:pass@
+ '(?:[\pN\pL\-\_\+\%\~]+(?::[\pN\pL\-\_\+\%\~]+)?\@)?'. //user:pass@
'(?:'.
'(?:'.
'\[[\pN\pL\-\_\:\.]+(?127.0.0.1:99'),
array('127.0.0.1/test.php',
'127.0.0.1/test.php'),
+ array('127.0.0.1/~test',
+ '127.0.0.1/~test'),
+ array('127.0.0.1/test%20stuff',
+ '127.0.0.1/test%20stuff'),
array('http://[::1]:99/test.php',
'http://[::1]:99/test.php'),
array('http://::1/test.php',