diff --git a/lib/util.php b/lib/util.php
index 388d295..756eff6 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -133,7 +133,8 @@ function text2html($sz) {
$base = hesc($sz);
$base = preg_replace('~^=+(.+)=+~m', '\\1', $base);
- $base = preg_replace('~(https?://[^ \\r\\n\\t]+)~i', '\\1', $base);
+ $base = preg_replace('~\\[url=([^\\]]+?)\\](.+?)\\[/url\\]~m', '\\2', $base);
+ $base = preg_replace('~([^="])(https?://[^ \\r\\n\\t]+)~i', '\\1\\2', $base);
$base = preg_replace('~\\[b\\](.+?)\\[/b\\]~m', '\\1', $base);
$base = preg_replace('~\\[i\\](.+?)\\[/i\\]~m', '\\1', $base);
$base = preg_replace('~\\[spoiler\\](.+?)\\[/spoiler\\]~m', '\\1', $base);