diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index ba12febd3d4e57da29ce1719e6312e0f538f9c66..4457e6279764cdfe936d72c052901b5655ce3364 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -446,9 +446,9 @@ if (! defined('NOLOGIN'))
                 $dol_authmode=$conf->authmode;	// This properties is defined only when logged, to say what mode was successfully used
                 $dol_tz=$_POST["tz"];
                 $dol_tz_string=$_POST["tz_string"];
-                $dol_tz_string=preg_replace('\s*\(.+\)$','',$dol_tz_string);
-                $dol_tz_string=preg_replace(',','/',$dol_tz_string);
-                $dol_tz_string=preg_replace('\s','_',$dol_tz_string);
+                $dol_tz_string=preg_replace('/\s*\(.+\)/$','',$dol_tz_string);
+                $dol_tz_string=preg_replace('/,/','/',$dol_tz_string);
+                $dol_tz_string=preg_replace('/\s/','_',$dol_tz_string);
                 $dol_dst=0;
                 if (isset($_POST["dst_first"]) && isset($_POST["dst_second"]))
                 {