diff --git a/includes/common.inc b/includes/common.inc
index a15bee61c609356cb10cf40637c69a71ddeb9a13..f326bdeca24eff951bdd84a6d7449491cdb256e3 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -596,11 +596,12 @@ function valid_email_address($mail) {
  *   TRUE if the URL is in a valid format.
  */
 function valid_url($url, $absolute = FALSE) {
+  $allowed_characters = '[a-z0-9\/:_\-_\.\?\$,~=#&%\+]';
   if ($absolute) {
-    return preg_match("/^(http|https|ftp):\/\/[a-z0-9\/:_\-_\.\?,~=#&%\+]+$/i", $url);
+    return preg_match("/^(http|https|ftp):\/\/". $allowed_characters ."+$/i", $url);
   }
   else {
-    return preg_match("/^[a-z0-9\/:_\-_\.,\+]+$/i", $url);
+    return preg_match("/^". $allowed_characters ."+$/i", $url);
   }
 }