diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php
index 55ac5dbec7a59421f194263330ed4bfb2de80c39..79e978cc2de1ea92fc417f983a12be6eb30785ba 100644
--- a/htdocs/bookmarks/fiche.php
+++ b/htdocs/bookmarks/fiche.php
@@ -167,7 +167,7 @@ if ($action == 'create')
 }
 
 
-if ($_GET["id"] > 0 && ! eregi('^add',$_GET["action"]))
+if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
 {
     /*
      * Fiche bookmark en mode visu ou edition
@@ -198,7 +198,7 @@ if ($_GET["id"] > 0 && ! eregi('^add',$_GET["action"]))
 
     print '<tr><td>'.$langs->trans("UrlOrLink").'</td><td>';
     if ($_GET["action"] == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$bookmark->url).'">';
-    else print '<a href="'.(eregi('^http',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'"'.($bookmark->target?' target="_blank"':'').'>'.$bookmark->url.'</a>';
+    else print '<a href="'.(preg_match('/^http/i',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'"'.($bookmark->target?' target="_blank"':'').'>'.$bookmark->url.'</a>';
     print '</td></tr>';
 
     print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php
index 398da6cb5ba711a2adc0adbcdbc0a30a114dcd85..e3689f8004be4d4286b518e92b9db275ba4aa976 100644
--- a/htdocs/cashdesk/include/environnement.php
+++ b/htdocs/cashdesk/include/environnement.php
@@ -57,7 +57,7 @@ $conf_taille_listes = 200;	// Nombre max de lignes a afficher dans les listes
 $conf_nbr_car_listes = 60;	// Nombre max de caracteres par ligne dans les listes
 
 //$new_conf_db_type=$conf_db_type;
-//if (eregi('mysql',$new_conf_db_type)) $new_conf_db_type='Mysql';
+//if (preg_match('/mysql/i',$new_conf_db_type)) $new_conf_db_type='Mysql';
 //require ('classes/'.$new_conf_db_type.'.class.php');
 //$sql = new Sql ($conf_db_host, $conf_db_user, $conf_db_pass, $conf_db_base);
 
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index dda3ff6a2cc57f2f0dddd4890bb220d2de436d67..28f3d72d6f6f8d38ccde0cfb1eea6adeaace0796 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -210,7 +210,7 @@ foreach($fulltree as $key => $val)
 	// If directory is brother of selected directory, we show line
 	elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3;
 	// If directory is parent of selected directory or is selected directory, we show line
-	elseif (eregi($val['fullpath'].'_',$fullpathselected.'_')) $showline=2;
+	elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2;
 	// If we are level one we show line
 	elseif ($val['level'] < 2) $showline=1;
 
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index 823c33b07ac7ed8fb59b692689f8aa4cad290400..73ee3ffba82d670736782e6bdf7cfb966378e13e 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -279,7 +279,7 @@ if ($_GET["id"] || $_GET["ref"])
 				print '<br>';
 
 				// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
-				if (!$obj['photo_vignette'] && eregi('(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$',$obj['photo']) && ($c->imgWidth > $maxWidth || $c->imgHeight > $maxHeight))
+				if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($c->imgWidth > $maxWidth || $c->imgHeight > $maxHeight))
 				{
 					print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
 				}
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 8b886509081a94a608a09581e77a6b36564f02e5..e71241ecccd33152507237a3cd0751a31fabf3a9 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -532,7 +532,7 @@ if ($_GET["action"] == 'create')
 	print '<br>';
 	print '<table class="border" width="100%">';
 
-	if (! empty($_GET["datep"]) && eregi('^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$',$_GET["datep"],$reg))
+	if (! empty($_GET["datep"]) && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',$_GET["datep"],$reg))
 	{
 		$actioncomm->datep=dol_mktime(0,0,0,$reg[2],$reg[3],$reg[1]);
 	}
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index c8742ad0872ae1fcf3049e95d2649b3fd3e47fb6..2b69a2d7a4eb3e0fbecdacdc9e657f6a5eb9b161 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -427,7 +427,7 @@ if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), arr
 // Add link to show birthdays
 $link='<a href="'.$_SERVER['PHP_SELF'];
 $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$param);
-if (! eregi('showbirthday=',$newparam)) $newparam.='&showbirthday=1';
+if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
 if ($_REQUEST['action']) $newparam.='&action='.$_REQUEST['action'];
 $link.='?'.$newparam;
 $link.='">';
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 0dc67d987abb62c8258c27320155908c391ea560..72aef1079a96188d3b6836c216b66c8b0c336826 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -239,7 +239,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
 					{
 						if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
 						{
-							if (eregi("(.*)\.modules\.php$",$file,$reg))
+							if (preg_match("/(.*)\.modules\.php$/i",$file,$reg))
 							{
 								$modulename=$reg[1];
 								if ($modulename == 'example') continue;
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index 098f37d6cac9b4d614e78be131eafd24754132e3..b281fd4a24df290980ed83cd1060a424456cc138 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -120,7 +120,7 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes')
 		$errorsto = $mil->email_errorsto;
 		// Le message est-il en html
 		$msgishtml=-1;	// Unknown by default
-		if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
+		if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
 
 		// Warning, we must not use begin-commit transaction here
 		// because we want to save update for each mail sent.
@@ -297,7 +297,7 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
 
 		// Le message est-il en html
 		$msgishtml=-1;	// Inconnu par defaut
-		if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
+		if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
 
 		// Pratique les substitutions sur le sujet et message
 		$mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest);
diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php
index 47b6e340fc52ec1aa0b46d41db2aa8f445cefadf..8bd2220982a52adb9abccb50e694fd17113cfa03 100644
--- a/htdocs/comm/mailing/index.php
+++ b/htdocs/comm/mailing/index.php
@@ -75,7 +75,7 @@ while (($file = readdir($handle))!==false)
 {
     if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
     {
-        if (eregi("(.*)\.(.*)\.(.*)",$file,$reg))
+        if (preg_match("/(.*)\.(.*)\.(.*)/i",$file,$reg))
         {
             $modulename=$reg[1];
    			if ($modulename == 'example') continue;
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 878359f6917026d061f17bee68d429949c15ea68..5e67f97afae74dd519c4713400f87d06cd196984 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -240,7 +240,7 @@ class Commande extends CommonObject
 		$result=$soc->set_as_client();
 
 		// Define new ref
-		if (! $error && (eregi('^\(PROV', $this->ref) || eregi('^PROV', $this->ref)))
+		if (! $error && (preg_match('/^\(PROV/i', $this->ref) || preg_match('/^PROV/i', $this->ref)))
 		{
 			$num = $this->getNextNumRef($soc);
 		}
@@ -291,7 +291,7 @@ class Commande extends CommonObject
 		if (! $error)
 		{
 			// Rename directory if dir was a temporary ref
-			if (eregi('^\(PROV', $this->ref) || eregi('^PROV', $this->ref))
+			if (preg_match('/^\(PROV/i', $this->ref) || preg_match('/^PROV/i', $this->ref))
 			{
 				// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref)
 				// afin de ne pas perdre les fichiers attaches
diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php
index 6459bdccce370e018f84dbdf4eb3a9f9b6600e7c..1a12d8450f4c37ab1bd1d84b99a1704fb5710032 100644
--- a/htdocs/compta/bank/account.class.php
+++ b/htdocs/compta/bank/account.class.php
@@ -831,7 +831,7 @@ class Account extends CommonObject
 		if (! empty($this->iban))
 		{
 			// If IBAN defined, we can know country of account from it
-			if (eregi("^([a-zA-Z][a-zA-Z])",$this->iban,$reg)) return $reg[1];
+			if (preg_match("/^([a-zA-Z][a-zA-Z])/i",$this->iban,$reg)) return $reg[1];
 		}
 
 		// We return country code
diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index c4ea9c3e01b3840e7cca63f2c9ece6fb39d4ac89..96f8e1243c3acaf4a9100989ac67e7905619ea4a 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -510,7 +510,7 @@ if ($account || $_GET["ref"])
 				//if ($isbanktransfert || $issocialcontrib) $showlabel=true;
 				if ($showlabel)
 				{
-					if (eregi('^\((.*)\)$',$objp->label,$reg))
+					if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
 					{
 						// Genereic description because between (). We show it after translating.
 						print $langs->trans($reg[1]);
@@ -565,9 +565,9 @@ if ($account || $_GET["ref"])
 					else {
 						//print ' - ';
 						print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
-						if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
+						if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
 						{
-							// Label g�n�rique car entre parenth�ses. On l'affiche en le traduisant
+							// Label generique car entre parentheses. On l'affiche en le traduisant
 							if ($reg[1]=='paiement') $reg[1]='Payment';
 							print $langs->trans($reg[1]);
 						}
@@ -592,7 +592,7 @@ if ($account || $_GET["ref"])
 					}
 					/*else if ($links[$key]['type']=='sc') {
 					 $chargestatic->id=$links[$key]['url_id'];
-						if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
+						if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
 						{
 						if ($reg[1]=='socialcontribution') $reg[1]='SocialContribution';
 						$chargestatic->lib=$langs->trans($reg[1]);
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index 21938a88b4add245d2cdf476509991d3fd71e395..fcca475d8c60050be568d95f793de07661371012 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -57,7 +57,7 @@ $form = new Form($db);
 
 // Get account informations
 $acct = new Account($db);
-if ($_GET["account"] && ! eregi(',',$_GET["account"]))	// if for a particular account and not a list
+if ($_GET["account"] && ! preg_match('/,/',$_GET["account"]))	// if for a particular account and not a list
 {
 	$result=$acct->fetch($_GET["account"]);
 }
@@ -140,7 +140,7 @@ print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
 print '<td colspan="3">';
 if ($_GET["account"])
 {
-	if (! eregi(',',$_GET["account"]))
+	if (! preg_match('/,/',$_GET["account"]))
 	{
 		print $form->showrefnav($acct,'ref','',1,'ref');
 	}
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index 8179c62440b8ae0082c80105010377ae4f4952b8..442f49d14338695f7da7a37e7a1f98cc9433f857 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -69,7 +69,7 @@ if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]);
 
 
 $acct = new Account($db);
-if ($_GET["account"] && ! eregi(',',$_GET["account"]))	// if for a particular account and not a list
+if ($_GET["account"] && ! preg_match('/,/',$_GET["account"]))	// if for a particular account and not a list
 {
 	$result=$acct->fetch($_GET["account"]);
 }
@@ -739,7 +739,7 @@ print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
 print '<td colspan="3">';
 if ($account)
 {
-	if (! eregi(',',$account))
+	if (! preg_match('/,/',$account))
 	{
 		$moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':'');
 		if ($_GET["option"]!='all')
diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php
index 3004d934c88da93ffc2bdf6d8de373e1ac286bc2..371632dec971e10d7a0c7776c0014ab98287167b 100644
--- a/htdocs/compta/bank/ligne.php
+++ b/htdocs/compta/bank/ligne.php
@@ -312,7 +312,7 @@ if ($result)
 		{
 			print '<td colspan="3">';
 			print '<input name="label" class="flat" value="';
-			if (eregi('^\((.*)\)$',$objp->label,$reg))
+			if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
 			{
 				// Label generique car entre parentheses. On l'affiche en le traduisant
 				print $langs->trans($reg[1]);
@@ -328,7 +328,7 @@ if ($result)
 		else
 		{
 			print '<td colspan="4">';
-			if (eregi('^\((.*)\)$',$objp->label,$reg))
+			if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
 			{
 				// Label generique car entre parentheses. On l'affiche en le traduisant
 				print $langs->trans($reg[1]);
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index 341e21dab5e631268f2a58498467e08abbcc0afa..c1b14c06aef5090521c774f0ee711ede8347cec4 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -145,7 +145,7 @@ if ($resql)
 
     if ($mesg) print $mesg."<br>";
 
-    // Affiche nom des derniers relev�s
+    // Affiche nom des derniers relev�s
     $nbmax=5;
     $liste="";
 
@@ -230,7 +230,7 @@ if ($resql)
 		// Description
         print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
 		$reg=array();
-		eregi('\((.+)\)',$objp->label,$reg);	// Si texte entour� de parenth�e on tente recherche de traduction
+		preg_match('/\((.+)\)/i',$objp->label,$reg);	// Si texte entoure de parenthee on tente recherche de traduction
 		if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
 		else print $objp->label;
         print '</a>';
@@ -300,9 +300,9 @@ if ($resql)
 			else {
 				//print ' - ';
 				print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
-				if (eregi('^\((.*)\)$',$links[$key]['label'],$reg))
+				if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
 				{
-					// Label g�n�rique car entre parenth�ses. On l'affiche en le traduisant
+					// Label generique car entre parentheses. On l'affiche en le traduisant
 					if ($reg[1]=='paiement') $reg[1]='Payment';
 					print $langs->trans($reg[1]);
 				}
@@ -327,12 +327,12 @@ if ($resql)
 
         if ($objp->rappro)
         {
-            // Si ligne d�j� rapproch�e, on affiche relev�.
+            // Si ligne d�j� rapproch�e, on affiche relev�.
             print "<td align=\"center\" nowrap=\"nowrap\"><a href=\"releve.php?num=$objp->num_releve&amp;account=$acct->id\">$objp->num_releve</a></td>";
         }
         else
         {
-            // Si pas encore rapproch�e
+            // Si pas encore rapproch�e
             if ($user->rights->banque->modifier)
             {
                 print '<td align="center" width="30" nowrap="nowrap">';
@@ -347,7 +347,7 @@ if ($resql)
                     print '</a>';
                 }
                 else {
-                    print "&nbsp;";	// On n'empeche la suppression car le raprochement ne pourra se faire qu'apr�s la date pass�e et que l'�criture apparaisse bien sur le compte.
+                    print "&nbsp;";	// On n'empeche la suppression car le raprochement ne pourra se faire qu'apr�s la date pass�e et que l'�criture apparaisse bien sur le compte.
                 }
                 print "</td>";
             }
@@ -358,7 +358,7 @@ if ($resql)
         }
 
 
-        // Affiche zone saisie relev� + bouton "Rapprocher"
+        // Affiche zone saisie relev� + bouton "Rapprocher"
         if ($objp->do <= gmmktime())
         {
             print '<td align="center" nowrap="nowrap">';
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index 69468fa0c7bcdfe5e3d7560d6227ed0d723ca475..b5a6fbb6128fb3417432b4244e12bb413289cb47 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -300,7 +300,7 @@ else
 			// Libelle
 			print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
 			$reg=array();
-			eregi('\((.+)\)',$objp->label,$reg);	// Si texte entoure de parenthese on tente recherche de traduction
+			preg_match('/\((.+)\)/i',$objp->label,$reg);	// Si texte entoure de parenthese on tente recherche de traduction
 			if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
 			else print $objp->label;
 			print '</a>';
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index c9df6c9e54635cdd9a4b0baf4b3452db9ff3daa7..c9ea98d1df8ce3e170ede43f681ce575e79094a9 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -189,7 +189,7 @@ if ($resql)
 
 		print "<td><a href=\"ligne.php?rowid=$objp->rowid&amp;account=$objp->fk_account\">";
 		$reg=array();
-		eregi('\((.+)\)',$objp->label,$reg);	// Si texte entour� de parenth�e on tente recherche de traduction
+		preg_match('/\((.+)\)/i',$objp->label,$reg);	// Si texte entoure de parenthee on tente recherche de traduction
 		if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
 		else print dol_trunc($objp->label,40);
 		print "</a>&nbsp;";
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 621da00f1f087d60f9228fffe79c29f24cc6b4a5..b8f44d72f7f505a659807d63e5f1abbe77d58cb2 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -127,7 +127,7 @@ print '<br>';
 
 clearstatcache();
 
-// Affiche lien sur autres ann�es
+// Affiche lien sur autres annees
 $linkforyear=array();
 $found=0;
 if (is_dir($dir))
@@ -135,7 +135,7 @@ if (is_dir($dir))
 	$handle=opendir($dir);
 	while (($file = readdir($handle))!==false)
 	{
-		if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
+		if (is_dir($dir.'/'.$file) && ! preg_match('/^\./',$file))
 		{
 			$found=1;
 			$linkforyear[]=$file;
@@ -165,7 +165,7 @@ if ($year)
 		$var=true;
 		while (($file = readdir($handle))!==false)
 		{
-	  if (eregi('^payment',$file))
+	  if (preg_match('/^payment/i',$file))
 	  {
 	  	$var=!$var;
 	  	$tfile = $dir . '/'.$year.'/'.$file;
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 5ccfad1387bd0e4590d1803471c7a88153c2da28..fa727b9d7c95f6dc5e9266bc602eacc622412e4a 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -151,7 +151,7 @@ if ($modecompta != 'CREANCES-DETTES') {
             $encaiss_ttc[$row->dm] += $row->amount_ttc;
 
 			// For DEBUG Only
-			if (eregi('^2007',$row->dm))
+			if (preg_match('/^2007/',$row->dm))
 			{
 			$subtotal_ht = $subtotal_ht + $row->amount_ht;
 			$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
@@ -210,7 +210,7 @@ if ($result)
         $decaiss_ttc[$row->dm] = $row->amount_ttc;
 
 		// For DEBUG Only
-		if (eregi('^2007',$row->dm))
+		if (preg_match('/^2007/',$row->dm))
 		{
 		$subtotal_ht = $subtotal_ht + $row->amount_ht;
 		$subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
@@ -311,7 +311,7 @@ else {
             $decaiss[$obj->dm] += $obj->amount;
             $decaiss_ttc[$obj->dm] += $obj->amount;
 			// For DEBUG Only
-			if (eregi('^2007',$obj->dm))
+			if (preg_match('/^2007/',$obj->dm))
 			{
 			$subtotal_ht = $subtotal_ht + $obj->amount;
 			$subtotal_ttc = $subtotal_ttc + $obj->amount;
@@ -342,7 +342,7 @@ else {
             $encaiss[$obj->dm] += $obj->amount;
             $encaiss_ttc[$obj->dm] += $obj->amount;
 			// For DEBUG Only
-			if (eregi('^2007',$obj->dm))
+			if (preg_match('/^2007/',$obj->dm))
 			{
 			$subtotal_ht = $subtotal_ht + $obj->amount;
 			$subtotal_ttc = $subtotal_ttc + $obj->amount;
@@ -410,7 +410,7 @@ if ($result) {
         $decaiss_ttc[$obj->dm] += $obj->amount_ttc;
 
 		// For DEBUG Only
-		if (eregi('^2007',$obj->dm))
+		if (preg_match('/^2007/',$obj->dm))
 		{
 		$subtotal_ht = $subtotal_ht + $obj->amount_ht;
 		$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
@@ -478,7 +478,7 @@ if ($result) {
         $decaiss_ttc[$obj->dm] += $obj->amount_ttc;
 
 		// For DEBUG Only
-		if (eregi('^2007',$obj->dm))
+		if (preg_match('/^2007/',$obj->dm))
 		{
 		$subtotal_ht = $subtotal_ht + $obj->amount_ht;
 		$subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php
index 3654703ef48677a8d0e03733a41fd420fa45a75a..0fd8976ed0978e9e56a3d12ccb7ebe3a4ebd644f 100644
--- a/htdocs/core/conf.class.php
+++ b/htdocs/core/conf.class.php
@@ -109,12 +109,12 @@ class Conf
 					if (! defined("$key")) define ("$key", $value);	// In some cases, the constant might be already forced (Example: SYSLOG_FILE during install)
 					$this->global->$key=$value;
 					// If this is constant for a css file activated by a module
-					if (eregi('^MAIN_MODULE_([A-Z_]+)_CSS$',$key) && $value)
+					if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key) && $value)
 					{
 						$this->css_modules[]=$value;
 					}
 					// If this is constant for a new tab page activated by a module
-					if (eregi('^MAIN_MODULE_([A-Z_]+)_TABS_',$key) && $value)
+					if (preg_match('/^MAIN_MODULE_([A-Z_]+)_TABS_/i',$key) && $value)
 					{
 						$params=explode(':',$value,2);
 						$this->tabs_modules[$params[0]][]=$value;
@@ -122,18 +122,18 @@ class Conf
 					}
 					// If this is constant to force a module directories (used to manage some exceptions)
 					// Should not be used by modules
-					if (eregi('^MAIN_MODULE_([A-Z_]+)_DIR_',$key,$reg) && $value)
+					if (preg_match('/^MAIN_MODULE_([A-Z_]+)_DIR_/i',$key,$reg) && $value)
 					{
 						$module=strtolower($reg[1]);
 						// If with submodule name
-						if (eregi('_DIR_([A-Z_]+)?_([A-Z]+)$',$key,$reg))
+						if (preg_match('/_DIR_([A-Z_]+)?_([A-Z]+)$/i',$key,$reg))
 						{
 							$dir_name  = "dir_".strtolower($reg[2]);
 							$submodule = strtolower($reg[1]);
 							$this->$module->$submodule->$dir_name = $value;		// We put only dir name. We will add DOL_DATA_ROOT later
 							//print '->'.$module.'->'.$submodule.'->'.$dir_name.' = '.$this->$module->$submodule->$dir_name.'<br>';
 						}
-						else if (eregi('_DIR_([A-Z]+)$',$key,$reg))
+						else if (preg_match('/_DIR_([A-Z]+)$/i',$key,$reg))
 						{
 							$dir_name  = "dir_".strtolower($reg[1]);
 							$this->$module->$dir_name = $value;		// We put only dir name. We will add DOL_DATA_ROOT later
@@ -141,14 +141,14 @@ class Conf
 						}
 					}
 					// If this is constant for a smarty need by a module
-					if (eregi('^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$',$key) && $value)
+					if (preg_match('/^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$/i',$key) && $value)
 					{
 						$module=strtolower($reg[1]);
 						// Add this module in list of modules that need smarty
 						$this->need_smarty[]=$module;
 					}
 					// If this is a module constant
-					if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
+					if (preg_match('/^MAIN_MODULE_([A-Z]+)$/i',$key,$reg) && $value)
 					{
 						$module=strtolower($reg[1]);
 						//print "Module ".$module." is enabled<br>\n";
diff --git a/htdocs/core/menubase.class.php b/htdocs/core/menubase.class.php
index 22951118e81005277d2fab4baf3f45e54b5f6612..52ca1de6d7f83eb4b269a29d7c27da2095f816fd 100644
--- a/htdocs/core/menubase.class.php
+++ b/htdocs/core/menubase.class.php
@@ -392,7 +392,7 @@ class Menubase
 					$title = $langs->trans($menu['titre']);
 					$langs->load($menu['langs']);
 				}
-				if (eregi("/",$title))
+				if (preg_match("/\//",$title))
 				{
 					$tab_titre = explode("/",$title);
 					$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
@@ -424,9 +424,9 @@ class Menubase
 				$tabMenu[$b][0] = $menu['rowid'];
 				$tabMenu[$b][1] = $menu['fk_menu'];
 				$tabMenu[$b][2] = $menu['url'];
-				if (! eregi("^(http:\/\/|https:\/\/)",$tabMenu[$b][2]))
+				if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b][2]))
 				{
-					if (eregi('\?',$tabMenu[$b][2])) $tabMenu[$b][2].='&amp;idmenu='.$menu['rowid'];
+					if (preg_match('/\?/',$tabMenu[$b][2])) $tabMenu[$b][2].='&amp;idmenu='.$menu['rowid'];
 					else $tabMenu[$b][2].='?idmenu='.$menu['rowid'];
 				}
 				$tabMenu[$b][3] = $chaine;
@@ -500,7 +500,7 @@ class Menubase
 					{
 						//				print "x".$pere." ".$tab[$x][6];
 
-						$this->newmenu->add((! eregi("^(http:\/\/|https:\/\/)",$tab[$x][2])) ? DOL_URL_ROOT . $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]);
+						$this->newmenu->add((! preg_match("/^(http:\/\/|https:\/\/)/i",$tab[$x][2])) ? DOL_URL_ROOT . $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]);
 						$this->recur($tab, $tab[$x][0], $rang +1);
 					}
 				}
@@ -622,7 +622,7 @@ class Menubase
 						$langs->load($objm->langs);
 					}
 
-					if (eregi("/",$title))
+					if (preg_match("/\//",$title))
 					{
 						$tab_titre = explode("/",$title);
 						$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 31e2ff42ef80e4b262bd5f7f40a74672ce1d1052..80f85e2784009ac61096a39da063d522501fe3df 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -238,7 +238,7 @@ print '<table class="border" width="100%"><tr><td width="40%" valign="top">';
 print '<table class="nobordernopadding" width="100%"><tr><td valign="top">';
 
 
-if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $action == 'delete')
+if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
 {
 	$userstatic = new User($db);
 	$ecmdirstatic = new ECMDirectory($db);
@@ -451,7 +451,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
 		$ecmdirstatic->ref=$val['label'];
 
 		// Refresh cache
-		if (eregi('refresh',$_GET['action']))
+		if (preg_match('/refresh/i',$_GET['action']))
 		{
 			$result=$ecmdirstatic->fetch($val['id']);
 			$ecmdirstatic->ref=$ecmdirstatic->label;
@@ -470,7 +470,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
 		// If directory is brother of selected directory, we show line
 		elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3;
 		// If directory is parent of selected directory or is selected directory, we show line
-		elseif (eregi($val['fullpath'].'_',$fullpathselected.'_')) $showline=2;
+		elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2;
 		// If we are level one we show line
 		elseif ($val['level'] < 2) $showline=1;
 
@@ -604,7 +604,7 @@ print '</td></tr>';
 
 // Actions buttons
 print '<tr height="22"><td align="center">';
-if (empty($action) || $action == 'file_manager' || eregi('refresh',$action))
+if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action))
 {
 	if ($user->rights->ecm->setup)
 	{
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 6296888dd9426e80e1041ed8164f4a0f20dde190..7e5a6f0e25bef3323a4a8c977935916c83388539 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -61,7 +61,7 @@ if ($_POST["action"] ==	'dispatch' && $user->rights->fournisseur->commande->rece
 
 	foreach($_POST as $key => $value)
 	{
-		if ( eregi('^product_([0-9]+)$', $key, $reg) )
+		if ( preg_match('/^product_([0-9]+)$/i', $key, $reg) )
 		{
 	  $prod = "product_".$reg[1];
 	  $qty = "qty_".$reg[1];
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 961c16960120417c4b751d55c121338b5e4811c2..a809c5cb182f163c16b23170fab1e7d4efa958bf 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -532,7 +532,7 @@ if ($id > 0 || ! empty($ref))
 			$commande->date_commande=gmmktime();
 
 			// We check if number is temporary number
-			if (eregi('^\(PROV',$commande->ref)) $newref = $commande->getNextNumRef($soc);
+			if (preg_match('/^\(PROV/i',$commande->ref)) $newref = $commande->getNextNumRef($soc);
 			else $newref = $commande->ref;
 
 			$text=$langs->trans('ConfirmValidateOrder',$newref);
diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php
index c99d671a23b78866456b1ae80d3b1da33c8ec1d8..8af057bbbab4e9296efb2bacca2f32a7a12de7c1 100644
--- a/htdocs/fourn/facture/paiementfourn.class.php
+++ b/htdocs/fourn/facture/paiementfourn.class.php
@@ -484,7 +484,7 @@ class PaiementFourn
 		$lienfin='</a>';
 
 		$text=$this->ref;	// Sometimes ref contains label
-		if (eregi('^\((.*)\)$',$text,$reg))
+		if (preg_match('/^\((.*)\)$/i',$text,$reg))
 		{
 			// Label g诩rique car entre parenth粥s. On l'affiche en le traduisant
 			if ($reg[1]=='paiement') $reg[1]='Payment';
diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php
index 6a13a9f1f450a76c111f30f73c705de4bb745f8a..0e0ef0241537b4e9f0bd934e8d9ad1d47e58783d 100644
--- a/htdocs/fourn/fournisseur.commande.class.php
+++ b/htdocs/fourn/fournisseur.commande.class.php
@@ -246,7 +246,7 @@ class CommandeFournisseur extends Commande
 			$soc->fetch($this->fourn_id);
 
 			// Check if object has a temporary ref
-			if (eregi('^\(PROV', $this->ref))
+			if (preg_match('/^\(PROV/i', $this->ref))
 			{
 				$num = $this->getNextNumRef($soc);
 			}
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 854d7fb10b43c656082f336fcf8c4a06b8d4ee68..0497875631d7c2e0de59fc0f1b4953ef195b6331 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -561,7 +561,7 @@ if ($step == 3 && $datatoimport)
 			// readdir return value in ISO and we want UTF8 in memory
 			if (! utf8_check($file)) $file=utf8_encode($file);
 
-			if (eregi('^\.',$file)) continue;
+			if (preg_match('/^\./',$file)) continue;
 
 			$modulepart='import';
 			$urlsource=$_SERVER["PHP_SELF"].'?step='.$step.$param.'&filetoimport='.urlencode($filetoimport);
@@ -841,10 +841,10 @@ if ($step == 4 && $datatoimport)
 
 		print '<td nowrap="nowrap" style="font-weight: normal">=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
 		print '<td style="font-weight: normal">';
-		$newlabel=preg_replace('/\*$/i','',$label);
+		$newlabel=preg_replace('/\*$/','',$label);
 		$text=$langs->trans($newlabel);
 		$more='';
-		if (eregi('\*$',$label))
+		if (preg_match('/\*$/',$label))
 		{
 			$text='<b>'.$text.'*</b>';
 			$more=((! empty($valforsourcefieldnb[$i]) && $valforsourcefieldnb[$i] <= sizeof($fieldssource)) ? '' : img_warning($langs->trans("FieldNeedSource")));
@@ -853,7 +853,7 @@ if ($step == 4 && $datatoimport)
 		}
 		$htmltext =$langs->trans("Table").": <b>".$tablename."</b><br>";
 		$htmltext.=$langs->trans("Field").': <b>'.$code."</b><br>";
-		$htmltext.=$langs->trans("Required").': <b>'.yn(eregi('\*$',$label)).'</b>';
+		$htmltext.=$langs->trans("Required").': <b>'.yn(preg_match('/\*$/',$label)).'</b>';
 		$note=$objimport->array_import_examplevalues[0][$code];
 		if ($note) $htmltext.='<br>'.$langs->trans("Note").'/'.$langs->trans("Example").': '.$note;
 		$text.=$more;
diff --git a/htdocs/includes/barcode/php-barcode/encode_bars.php b/htdocs/includes/barcode/php-barcode/encode_bars.php
index c1fb5f0e7a84ceb81d6b6ca48f2b40613f40b3d9..c8ec8c5a0265da951073ef473c29e262f4438ff8 100644
--- a/htdocs/includes/barcode/php-barcode/encode_bars.php
+++ b/htdocs/includes/barcode/php-barcode/encode_bars.php
@@ -47,7 +47,7 @@ function barcode_encode_ean($ean, $encoding = "EAN-13"){
     $guards=array("9a1a","1a1a1","a1a");
 
     $ean=trim($ean);
-    if (eregi("[^0-9]",$ean)){
+    if (preg_match("/[^0-9]/i",$ean)){
 	return array("text"=>"Invalid EAN-Code");
     }
     $encoding=strtoupper($encoding);
diff --git a/htdocs/includes/barcode/php-barcode/php-barcode.php b/htdocs/includes/barcode/php-barcode/php-barcode.php
index 19e9cf6beef3f9e3382db4a557d8b549b2aa1ab5..e370cda983c5e588b9a236cc3e88e64b581aa7f4 100644
--- a/htdocs/includes/barcode/php-barcode/php-barcode.php
+++ b/htdocs/includes/barcode/php-barcode/php-barcode.php
@@ -342,7 +342,7 @@ function barcode_outhtml($code, $bars, $scale = 1, $total_y = 0, $space = ''){
 function barcode_encode_genbarcode($code,$encoding){
     global $genbarcode_loc;
     /* delete EAN-13 checksum */
-    if (eregi("^ean$", $encoding) && strlen($code)==13) $code=substr($code,0,12);
+    if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12);
     if (!$encoding) $encoding="ANY";
     $encoding=preg_replace("/[|\\]/", "_", $encoding);
     $code=preg_replace("/[|\\]/", "_", $code);
@@ -398,12 +398,12 @@ function barcode_encode($code,$encoding){
 		((preg_match("/^ean$/i", $encoding)
 		 && ( strlen($code)==12 || strlen($code)==13)))
 
-		|| (($encoding) && (eregi("^isbn$", $encoding))
+		|| (($encoding) && (preg_match("/^isbn$/i", $encoding))
 		 && (( strlen($code)==9 || strlen($code)==10) ||
 		 (((preg_match("/^978/", $code) && strlen($code)==12) ||
 		  (strlen($code)==13)))))
 
-		|| (( !isset($encoding) || !$encoding || (eregi("^ANY$", $encoding) ))
+		|| (( !isset($encoding) || !$encoding || (preg_match("/^ANY$/i", $encoding) ))
 		 && (preg_match("/^[0-9]{12,13}$/", $code)))
 
 		){
@@ -445,8 +445,8 @@ function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png" ){
 	$bars=barcode_encode($code,$encoding);
     if (!$bars) return;
     if (!$mode) $mode="png";
-    if (eregi($mode,"^(text|txt|plain)$")) print barcode_outtext($bars['text'],$bars['bars']);
-    elseif (eregi($mode,"^(html|htm)$")) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0);
+    if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']);
+    elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0);
     else barcode_outimage($bars['text'],$bars['bars'],$scale, $mode);
     return $bars;
 }
diff --git a/htdocs/includes/fpdf/fpdf/fpdf.php b/htdocs/includes/fpdf/fpdf/fpdf.php
index 3cfb11eef1f50aa2244e80c8a423f93887ee6ca3..cfb4a398dfbb48823af94c2e7e59a07356ae6130 100644
--- a/htdocs/includes/fpdf/fpdf/fpdf.php
+++ b/htdocs/includes/fpdf/fpdf/fpdf.php
@@ -2292,13 +2292,13 @@ function _enddoc()
 				}
 				case 'span': {
 					if (isset($attr['style']) && $attr['style']!='') {
-						if (eregi("color",$attr['style'])){
-							if (eregi("rgb",$attr['style'])){
+						if (preg_match("/color/i",$attr['style'])){
+							if (preg_match("/rgb/i",$attr['style'])){
 								//print 'style rgb '.$attr['style'].'<br>';
 								$coul = substr($attr['style'],11,-2);
 								list($R, $G, $B) = explode(', ', $coul);
 							}
-							else if (eregi("#",$attr['style'])){
+							else if (preg_match("/#/",$attr['style'])){
 								//print 'style hexa '.$attr['style'].'<br>';
 								$R = hexdec(substr($attr['style'],8,2));
 								$G = hexdec(substr($attr['style'],10,2));
@@ -2308,7 +2308,7 @@ function _enddoc()
 							$this->SetTextColor($R,$G,$B);
 							$this->issetcolor=true;
 						}
-						if (eregi("font-family",$attr['style'])){
+						if (preg_match("/font-family/i",$attr['style'])){
 							$fontName = substr($attr['style'],13,-1);
 							$fontName = $this->convertNameFont($fontName);
 							if (isset($fontName) && in_array(strtolower($fontName), $this->fontlist)) {
@@ -2317,7 +2317,7 @@ function _enddoc()
 								//print 'fontfamily: '.$this->FontFamily.'<br>';
 							}
 						}
-						if (eregi("font-size",$attr['style'])){
+						if (preg_match("/font-size/i",$attr['style'])){
 							$headsize = substr($attr['style'],11);
 							$headsize = preg_replace('/[;-]/','',$headsize);
 							//print 'headsize1: '.$headsize.'<br>';
diff --git a/htdocs/includes/menus/barre_left/auguria_backoffice.php b/htdocs/includes/menus/barre_left/auguria_backoffice.php
index c8c9072aa0f73959b891a76eb5177f7070b4d0fd..d352d542981751f5af518366cc6565f19e5f005d 100644
--- a/htdocs/includes/menus/barre_left/auguria_backoffice.php
+++ b/htdocs/includes/menus/barre_left/auguria_backoffice.php
@@ -158,9 +158,9 @@ class MenuLeft {
 
 				// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
 				$url=$this->menu_array[$i]['url'];
-				if (! eregi('mainmenu=',$this->menu_array[$i]['url']))
+				if (! preg_match('/mainmenu=/i',$this->menu_array[$i]['url']))
 				{
-					if (! eregi('\?',$url)) $url.='?';
+					if (! preg_match('/\?/',$url)) $url.='?';
 					else $url.='&';
 					$url.='mainmenu='.$mainmenu;
 				}
diff --git a/htdocs/includes/menus/barre_left/auguria_frontoffice.php b/htdocs/includes/menus/barre_left/auguria_frontoffice.php
index 7038552be1feeb50c0a31c53d096338aaa424ca5..db3cfd89d7262e2ebfd336a172b212eb9549e162 100644
--- a/htdocs/includes/menus/barre_left/auguria_frontoffice.php
+++ b/htdocs/includes/menus/barre_left/auguria_frontoffice.php
@@ -158,9 +158,9 @@ class MenuLeft {
 
 				// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
 				$url=$this->menu_array[$i]['url'];
-				if (! eregi('mainmenu=',$this->menu_array[$i]['url']))
+				if (! preg_match('/mainmenu=/i',$this->menu_array[$i]['url']))
 				{
-					if (! eregi('\?',$url)) $url.='?';
+					if (! preg_match('/\?/',$url)) $url.='?';
 					else $url.='&';
 					$url.='mainmenu='.$mainmenu;
 				}
diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php
index 9053d5897599c792bdd3437f13ba84a9fe7c867f..bcf42a09e8b09b31a2dd80cce5f7e3c741e1f673 100644
--- a/htdocs/includes/menus/barre_left/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php
@@ -429,21 +429,21 @@ class MenuLeft {
 					$newmenu->add(DOL_URL_ROOT."/compta/facture.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),1,$user->rights->facture->lire);
 					if ($user->societe_id == 0)
 					{
-						if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/clients.php?action=facturer&amp;leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
+						if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/clients.php?action=facturer&amp;leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
 					}
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),2,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire);
 
 					if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
 					{
-						if (eregi("customers_bills_payments",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),3,$user->rights->facture->lire);
+						if (preg_match("/customers_bills_payments/i",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),3,$user->rights->facture->lire);
 					}
-					if (eregi("customers_bills_payments",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/rapport.php?leftmenu=customers_bills_payments",$langs->trans("Reportings"),3,$user->rights->facture->lire);
+					if (preg_match("/customers_bills_payments/i",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/rapport.php?leftmenu=customers_bills_payments",$langs->trans("Reportings"),3,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
 				}
 
 				// Proposals
@@ -484,17 +484,17 @@ class MenuLeft {
 				if ($conf->tax->enabled)
 				{
 					$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
 					// VAT
 					if ($conf->compta->tva)
 					{
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
 					}
 				}
 
@@ -545,8 +545,8 @@ class MenuLeft {
 				if ($conf->facture->enabled && $conf->banque->enabled)
 				{
 					$newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/index.php?leftmenu=checks",$langs->trans("MenuChequeDeposits"),0,$user->rights->banque->cheque);
-					if (eregi("checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
-					if (eregi("checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->banque->cheque);
+					if (preg_match("/checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
+					if (preg_match("/checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->banque->cheque);
 				}
 
 				// Bank-Caisse
@@ -851,8 +851,8 @@ class MenuLeft {
 					{
 						$langs->load("bills");
 						$newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/index.php?leftmenu=members_checks",$langs->trans("MenuChequeDeposits"),0,$user->rights->adherent->cotisation->lire);
-						if (eregi("members_checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=members_checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->adherent->cotisation->creer);
-						if (eregi("members_checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=members_checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->adherent->cotisation->lire);
+						if (preg_match("/members_checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=members_checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->adherent->cotisation->creer);
+						if (preg_match("/members_checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=members_checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->adherent->cotisation->lire);
 					}
 
 					if ($conf->banque->enabled)
diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php
index 0e0070147750b8325ee5619e304ccdb002b3b954..31961e70abafcdd2e9cc774a52161a96db0a48d2 100644
--- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php
@@ -436,22 +436,22 @@ class MenuLeft {
 					$newmenu->add(DOL_URL_ROOT."/compta/facture.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),1,$user->rights->facture->lire);
 					if ($user->societe_id == 0)
 					{
-						if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/clients.php?action=facturer&amp;leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
+						if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/clients.php?action=facturer&amp;leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
 					}
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),2,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire);
 
 					if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
 					{
-						if (eregi("customers_bills_payments",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),3,$user->rights->facture->lire);
+						if (preg_match("/customers_bills_payments/i",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),3,$user->rights->facture->lire);
 					}
-					if (eregi("customers_bills_payments",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/rapport.php?leftmenu=customers_bills_payments",$langs->trans("Reportings"),3,$user->rights->facture->lire);
+					if (preg_match("/customers_bills_payments/i",$leftmenu))  $newmenu->add(DOL_URL_ROOT."/compta/paiement/rapport.php?leftmenu=customers_bills_payments",$langs->trans("Reportings"),3,$user->rights->facture->lire);
 
-					if (eregi("customers_bills",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
+					if (preg_match("/customers_bills/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
 				}
 
 				// Proposals
@@ -492,17 +492,17 @@ class MenuLeft {
 				if ($conf->tax->enabled)
 				{
 					$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
-					if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
+					if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
 					// VAT
 					if ($conf->compta->tva)
 					{
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
-						if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=tax_vat&amp;mainmenu=accountancy",$langs->trans("VAT"),1,$user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
+						if (preg_match('/^tax/i',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire);
 					}
 				}
 
@@ -557,8 +557,8 @@ class MenuLeft {
 				if ($conf->facture->enabled && $conf->banque->enabled)
 				{
 				$newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/index.php?leftmenu=checks",$langs->trans("MenuChequeDeposits"),0,$user->rights->banque->cheque);
-				if (eregi("checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
-				if (eregi("checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->banque->cheque);
+				if (preg_match("/checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->banque->cheque);
+				if (preg_match("/checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->banque->cheque);
 				}
 				*/
 
@@ -857,8 +857,8 @@ class MenuLeft {
 					{
 						$langs->load("bills");
 						$newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/index.php?leftmenu=members_checks",$langs->trans("MenuChequeDeposits"),0,$user->rights->adherent->cotisation->lire);
-						if (eregi("members_checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=members_checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->adherent->cotisation->creer);
-						if (eregi("members_checks",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=members_checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->adherent->cotisation->lire);
+						if (preg_match("/members_checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/fiche.php?leftmenu=members_checks&amp;action=new",$langs->trans("NewChequeDeposit"),1,$user->rights->adherent->cotisation->creer);
+						if (preg_match("/members_checks/i",$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/paiement/cheque/liste.php?leftmenu=members_checks",$langs->trans("MenuChequesReceipts"),1,$user->rights->adherent->cotisation->lire);
 					}
 
 					if ($conf->banque->enabled)
diff --git a/htdocs/includes/menus/barre_top/auguria_backoffice.php b/htdocs/includes/menus/barre_top/auguria_backoffice.php
index 266e3b09eb9625693029851330d58de96eb87a23..ba03879b27ee3c887e1dff72aa8b5fef12025dff 100644
--- a/htdocs/includes/menus/barre_top/auguria_backoffice.php
+++ b/htdocs/includes/menus/barre_top/auguria_backoffice.php
@@ -90,7 +90,7 @@ class MenuTop {
 						$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
 						if (! preg_match('/\?/',$url)) $url.='?';
 						else $url.='&';
-						if (! preg_match('/mainmenu/i',$url) || ! eregi('leftmenu',$url))
+						if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
 						{
 							$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=&';
 						}
diff --git a/htdocs/includes/menus/barre_top/auguria_frontoffice.php b/htdocs/includes/menus/barre_top/auguria_frontoffice.php
index 61d86926aab8ae54f1309bbf48596917014e854b..13bdaae6d7d0f0a6d081301edaa0a0a79396c1a0 100644
--- a/htdocs/includes/menus/barre_top/auguria_frontoffice.php
+++ b/htdocs/includes/menus/barre_top/auguria_frontoffice.php
@@ -81,16 +81,16 @@ class MenuTop {
 				if ($tabMenu[$i]['right'] == true)	// Is allowed
 				{
 					// Define url
-					if (eregi("^(http:\/\/|https:\/\/)",$tabMenu[$i]['url']))
+					if (preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$i]['url']))
 					{
 						$url = $tabMenu[$i]['url'];
 					}
 					else
 					{
 						$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
-						if (! eregi('\?',$url)) $url.='?';
+						if (! preg_match('/\?/',$url)) $url.='?';
 						else $url.='&';
-						if (! eregi('mainmenu',$url) || ! eregi('leftmenu',$url))
+						if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
 						{
 							$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=&';
 						}
diff --git a/htdocs/includes/menus/barre_top/eldy_backoffice.php b/htdocs/includes/menus/barre_top/eldy_backoffice.php
index fc6424a7e93e7e7ec5e1f9bf457d6ff27cdeafb3..07dfed3d796e9dff77c918ba80b7183914665dec 100644
--- a/htdocs/includes/menus/barre_top/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_top/eldy_backoffice.php
@@ -418,16 +418,16 @@ class MenuTop {
 				$idsel=(empty($tabMenu[$i]['mainmenu'])?'none':$tabMenu[$i]['mainmenu']);
 				if ($tabMenu[$i]['right'] == true)	// Is allowed
 				{
-					if (eregi("^(http:\/\/|https:\/\/)",$tabMenu[$i]['url']))
+					if (preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$i]['url']))
 					{
 						$url = $tabMenu[$i]['url'];
 					}
 					else
 					{
 						$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
-						if (! eregi('\?',$url)) $url.='?';
+						if (! preg_match('/\?/',$url)) $url.='?';
 						else $url.='&';
-						if (! eregi('mainmenu',$url) || ! eregi('leftmenu',$url))
+						if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
 						{
 							$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=&';
 						}
diff --git a/htdocs/includes/menus/barre_top/eldy_frontoffice.php b/htdocs/includes/menus/barre_top/eldy_frontoffice.php
index 9c1a3ed3d3313e6e8a4b9f7be94b419755e23a92..0d14b9d9a08e692dcbf587d70f622fcaef30c79d 100644
--- a/htdocs/includes/menus/barre_top/eldy_frontoffice.php
+++ b/htdocs/includes/menus/barre_top/eldy_frontoffice.php
@@ -417,16 +417,16 @@ class MenuTop {
 				$idsel=(empty($tabMenu[$i]['mainmenu'])?'none':$tabMenu[$i]['mainmenu']);
 				if ($tabMenu[$i]['right'] == true)	// Is allowed
 				{
-					if (eregi("^(http:\/\/|https:\/\/)",$tabMenu[$i]['url']))
+					if (preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$i]['url']))
 					{
 						$url = $tabMenu[$i]['url'];
 					}
 					else
 					{
 						$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
-						if (! eregi('\?',$url)) $url.='?';
+						if (! preg_match('/\?/',$url)) $url.='?';
 						else $url.='&';
-						if (! eregi('mainmenu',$url) || ! eregi('leftmenu',$url))
+						if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
 						{
 							$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=&';
 						}
diff --git a/htdocs/includes/menus/barre_top/empty.php b/htdocs/includes/menus/barre_top/empty.php
index 6462935c5e56bd89f495ffe6e0d8a3b27bf7a899..be0bef5455471f68eef613deecf58aac0fb25237 100644
--- a/htdocs/includes/menus/barre_top/empty.php
+++ b/htdocs/includes/menus/barre_top/empty.php
@@ -86,7 +86,7 @@ class MenuTop {
 	        	if ($tabMenu[$i]['right'] == true)
 	        	{
 					$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
-					if (! eregi('\?',DOL_URL_ROOT.$tabMenu[$i]['url'])) $url.='?';
+					if (! preg_match('/\?/',DOL_URL_ROOT.$tabMenu[$i]['url'])) $url.='?';
 					else $url.='&';
 					$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=';
 					$url.="&idmenu=".$tabMenu[$i]['rowid'];
diff --git a/htdocs/includes/menus/barre_top/rodolphe.php b/htdocs/includes/menus/barre_top/rodolphe.php
index f4a7c56d75cffbba3e8afae4451432871c7d2654..e37d362211d513f5a772ef7e412afb1b42f89e52 100644
--- a/htdocs/includes/menus/barre_top/rodolphe.php
+++ b/htdocs/includes/menus/barre_top/rodolphe.php
@@ -360,14 +360,14 @@ class MenuTop {
         		$idsel=(empty($tabMenu[$i]['mainmenu'])?'id="none" ':'id="'.$tabMenu[$i]['mainmenu'].'" ');
         		if ($tabMenu[$i]['right'] == true)
 	        	{
-	        		if (eregi("^(http:\/\/|https:\/\/)",$tabMenu[$i]['url']))
+	        		if (preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$i]['url']))
 	        		{
 	        			$url = $tabMenu[$i]['url'];
 	        		}
 	        		else
 	        		{
 	        			$url=DOL_URL_ROOT.$tabMenu[$i]['url'];
-	        			if (! eregi('\?',DOL_URL_ROOT.$tabMenu[$i]['url'])) $url.='?';
+	        			if (! preg_match('/\?/',DOL_URL_ROOT.$tabMenu[$i]['url'])) $url.='?';
 	        			else $url.='&';
 	        			$url.='mainmenu='.$tabMenu[$i]['mainmenu'].'&leftmenu=';
 	        			$url.="&idmenu=".$tabMenu[$i]['rowid'];
diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php
index 6aadcaf11ee93d4e7c8f657e469af8d4796c1b74..daac4463e22c0e372b7d96d3ffd168f02d1d73cb 100644
--- a/htdocs/includes/modules/DolibarrModules.class.php
+++ b/htdocs/includes/modules/DolibarrModules.class.php
@@ -451,7 +451,7 @@ class DolibarrModules
 				{
 					while (($file = readdir($handle))!==false)
 					{
-						if (eregi('\.sql$',$file) && ! eregi('\.key\.sql$',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
+						if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
 						{
 							$result=run_sql($dir.$file,1);
 						}
@@ -465,7 +465,7 @@ class DolibarrModules
 				{
 					while (($file = readdir($handle))!==false)
 					{
-						if (eregi('\.key\.sql$',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
+						if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
 						{
 							$result=run_sql($dir.$file,1);
 						}
@@ -479,7 +479,7 @@ class DolibarrModules
 				{
 					while (($file = readdir($handle))!==false)
 					{
-						if (eregi('\.sql$',$file) && ! eregi('\.key\.sql$',$file) && substr($file,0,4) == 'data')
+						if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
 						{
 							$result=run_sql($dir.$file,1);
 						}
diff --git a/htdocs/includes/modules/commande/mod_commande_marbre.php b/htdocs/includes/modules/commande/mod_commande_marbre.php
index 34ae5b05f804dc40e175471f1de5253f64d96bdc..a099c25e3f0dc21c92e91406b83a76f403341c95 100644
--- a/htdocs/includes/modules/commande/mod_commande_marbre.php
+++ b/htdocs/includes/modules/commande/mod_commande_marbre.php
@@ -79,7 +79,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
       	$row = $db->fetch_row($resql);
         if ($row) $coyymm = substr($row[0],0,6);
       }
-      if ($coyymm && ! eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$coyymm))
+      if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm))
       {
       	$this->error='Une commande commencant par $coyymm existe en base et est incompatible avec cette numerotation. Supprimer la ou renommer la pour activer ce module.';
       	return false;    
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 795010e011e85f6eb8278282e14b5ada0ca21ce0..ae3e41c8efe8360c091cf07a8ec82f35ceeea9fa 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -568,7 +568,7 @@ class pdf_einstein extends ModelePDFCommandes
 				$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
 
 				$tvacompl='';
-				if (eregi('\*',$tvakey))
+				if (preg_match('/\*/',$tvakey))
 				{
 					$tvakey=str_replace('*','',$tvakey);
 					$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
diff --git a/htdocs/includes/modules/export/export_csv.modules.php b/htdocs/includes/modules/export/export_csv.modules.php
index ef2d359bc85b365ae6852d774468b7442e310a4c..5e6653e30549786161feebf74ccf5eee9a2ebcfa 100644
--- a/htdocs/includes/modules/export/export_csv.modules.php
+++ b/htdocs/includes/modules/export/export_csv.modules.php
@@ -199,7 +199,7 @@ class ExportCsv extends ModeleExports
 			$newvalue=$outputlangs->convToOutputCharset($objp->$alias);
 
 			// Translation newvalue
-			if (eregi('^\((.*)\)$',$newvalue,$reg))
+			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
 			{
 				$newvalue=$outputlangs->transnoentities($reg[1]);
 			}
diff --git a/htdocs/includes/modules/export/export_excel.modules.php b/htdocs/includes/modules/export/export_excel.modules.php
index b5835c8803229875c99304905b057890a16186ce..8fa84c9e6272cc30670185959805a67caef6b1be 100644
--- a/htdocs/includes/modules/export/export_excel.modules.php
+++ b/htdocs/includes/modules/export/export_excel.modules.php
@@ -203,7 +203,7 @@ class ExportExcel extends ModeleExports
 			$newvalue=$this->excel_clean($newvalue);
 
 			// Traduction newvalue
-			if (eregi('^\((.*)\)$',$newvalue,$reg))
+			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
 			{
 				$newvalue=$outputlangs->transnoentities($reg[1]);
 			}
@@ -212,14 +212,14 @@ class ExportExcel extends ModeleExports
 				$newvalue=$outputlangs->convToOutputCharset($newvalue);
 			}
 
-			if (eregi('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',$newvalue))
+			if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i',$newvalue))
 			{
 				$arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
 				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
 				$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]);	// $newvalue=strval(36892.521); directly does not work because . will be convert into , later
 				$this->worksheet->write($this->row, $this->col, $newvalue, $formatdate);
 			}
-			elseif (eregi('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$',$newvalue))
+			elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i',$newvalue))
 			{
 				$arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
 				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
diff --git a/htdocs/includes/modules/export/export_tsv.modules.php b/htdocs/includes/modules/export/export_tsv.modules.php
index a9d7cd48ee4a771e8471b18dfa8e1317a2e0ec82..7cf1a134312b1458be58d35ad7bfc7663533fdcb 100644
--- a/htdocs/includes/modules/export/export_tsv.modules.php
+++ b/htdocs/includes/modules/export/export_tsv.modules.php
@@ -171,7 +171,7 @@ class ExportTsv extends ModeleExports
             $newvalue=$objp->$alias;
 
             // Translation newvalue
-			if (eregi('^\((.*)\)$',$newvalue,$reg))
+			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
 			{
 				$newvalue=$outputlangs->transnoentities($reg[1]);
 			}
diff --git a/htdocs/includes/modules/export/modules_export.php b/htdocs/includes/modules/export/modules_export.php
index 5af5c80463ede8fe670a5bd366721eb7a1a1d223..96113f5f4cea1014e696578b45ddea6c9ed1fa25 100644
--- a/htdocs/includes/modules/export/modules_export.php
+++ b/htdocs/includes/modules/export/modules_export.php
@@ -66,7 +66,7 @@ class ModeleExports
 		$i=0;
 		while (($file = readdir($handle))!==false)
 		{
-			if (eregi("^export_(.*)\.modules\.php$",$file,$reg))
+			if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
 			{
 				$moduleid=$reg[1];
 
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 5ba3507ae13a451b1172004f013e04d471f6a35f..076db0a9e17ec96a3365eabcd1002a5312123545 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -716,7 +716,7 @@ class pdf_crabe extends ModelePDFFactures
 					$index++;
 					$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
 					$tvacompl='';
-					if (eregi('\*',$tvakey))
+					if (preg_match('/\*/',$tvakey))
 					{
 						$tvakey=str_replace('*','',$tvakey);
 						$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php
index c9ea75f5497a7900ad3c3f370a1b3c0f8eadd635..81b8ca653b486f11743272360ce75f2f4d9873f1 100644
--- a/htdocs/includes/modules/facture/pdf_oursin.modules.php
+++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php
@@ -639,7 +639,7 @@ class pdf_oursin extends ModelePDFFactures
 					$index++;
 					$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
 					$tvacompl='';
-					if (eregi('\*',$tvakey))
+					if (preg_match('/\*/',$tvakey))
 					{
 						$tvakey=str_replace('*','',$tvakey);
 						$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
diff --git a/htdocs/includes/modules/facture/terre/terre.modules.php b/htdocs/includes/modules/facture/terre/terre.modules.php
index 0e6e0aacdaf7fd236a91daaa06f5b994b861d0bd..b36d9b3c4f4a47516e2fe968b395358d4de34ca1 100644
--- a/htdocs/includes/modules/facture/terre/terre.modules.php
+++ b/htdocs/includes/modules/facture/terre/terre.modules.php
@@ -82,7 +82,7 @@ class mod_facture_terre extends ModeleNumRefFactures
 			$row = $db->fetch_row($resql);
 			if ($row) $fayymm = substr($row[0],0,6);
 		}
-		if ($fayymm && ! eregi($this->prefixinvoice.'[0-9][0-9][0-9][0-9]',$fayymm))
+		if ($fayymm && ! preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$fayymm))
 		{
 			$this->error=$langs->trans('TerreNumRefModelError');
 			return false;
@@ -102,7 +102,7 @@ class mod_facture_terre extends ModeleNumRefFactures
 			$row = $db->fetch_row($resql);
 			if ($row) $fayymm = substr($row[0],0,6);
 		}
-		if ($fayymm && ! eregi($this->prefixcreditnote.'[0-9][0-9][0-9][0-9]',$fayymm))
+		if ($fayymm && ! preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i',$fayymm))
 		{
 			$this->error=$langs->trans('TerreNumRefModelError');
 			return false;
diff --git a/htdocs/includes/modules/fichinter/mod_pacific.php b/htdocs/includes/modules/fichinter/mod_pacific.php
index 7cea35f9d6520bfa6d0e4e129270e95e756c0c42..bdcd4ac9e35dedf8d53f60e6cac6f1034e8fdaa6 100644
--- a/htdocs/includes/modules/fichinter/mod_pacific.php
+++ b/htdocs/includes/modules/fichinter/mod_pacific.php
@@ -21,7 +21,7 @@
 /**
     \file       htdocs/includes/modules/fichinter/mod_pacific.php
 	\ingroup    fiche intervention
-	\brief      Fichier contenant la classe du mod�le de num�rotation de r�f�rence de fiche intervention Pacific
+	\brief      Fichier contenant la classe du modele de numerotation de reference de fiche intervention Pacific
 	\version    $Id$
 */
 
@@ -29,7 +29,7 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/modules_fichinter.p
 
 /**
     \class      mod_pacific
-		\brief      Classe du mod�le de num�rotation de r�f�rence de fiche intervention Pacific
+		\brief      Classe du moderotation de reference de fiche intervention Pacific
 */
 
 class mod_pacific extends ModeleNumRefFicheinter
@@ -46,7 +46,7 @@ class mod_pacific extends ModeleNumRefFicheinter
 	}
 
 
-    /**     \brief      Renvoi la description du modele de num�rotation
+    /**     \brief      Renvoi la description du modele de numerotation
      *      \return     string      Texte descripif
      */
     function info()
@@ -58,7 +58,7 @@ class mod_pacific extends ModeleNumRefFicheinter
     	return $langs->trans('PacificNumRefModelDesc1',$this->prefix);
     }
 
-    /**     \brief      Renvoi un exemple de num�rotation
+    /**     \brief      Renvoi un exemple de numerotation
      *      \return     string      Example
      */
     function getExample()
@@ -66,8 +66,8 @@ class mod_pacific extends ModeleNumRefFicheinter
         return $this->prefix."0501-0001";
     }
 
-    /**     \brief      Test si les num�ros d�j� en vigueur dans la base ne provoquent pas de
-     *                  de conflits qui empechera cette num�rotation de fonctionner.
+    /**     \brief      Test si les numeros deja en vigueur dans la base ne provoquent pas de
+     *                  de conflits qui empechera cette numerotation de fonctionner.
      *      \return     boolean     false si conflit, true si ok
      */
 	function canBeActivated()
@@ -88,7 +88,7 @@ class mod_pacific extends ModeleNumRefFicheinter
 			$row = $db->fetch_row($resql);
 			if ($row) $fayymm = substr($row[0],0,6);
 		}
-		if (! $fayymm || eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$fayymm))
+		if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm))
 		{
 			return true;
 		}
@@ -99,8 +99,8 @@ class mod_pacific extends ModeleNumRefFicheinter
 		}
 	}
 
-	/**		\brief      Renvoi prochaine valeur attribu�e
-	*      	\param      objsoc      Objet soci�t�
+	/**		\brief      Renvoi prochaine valeur attribuee
+	*      	\param      objsoc      Objet societe
 	*      	\param      ficheinter	Object ficheinter
 	*      	\return     string      Valeur
 	*/
@@ -108,7 +108,7 @@ class mod_pacific extends ModeleNumRefFicheinter
 	{
 		global $db,$conf;
 		
-		// D'abord on r�cup�re la valeur max (r�ponse imm�diate car champ ind�x�)
+		// D'abord on recupere la valeur max (reponse immediate car champ indexe)
     $posindice=8;
     
     $sql = "SELECT MAX(0+SUBSTRING(ref,".$posindice.")) as max";
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index 71754459662f6c36d313e895931757e5a9722316..6e81bfaca91a936af11eea4fa5ba547a15791a66 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -108,7 +108,7 @@ class pdf_soleil extends ModelePDFFicheinter
 
 			$fichref = dol_sanitizeFileName($fichinter->ref);
 			$dir = $conf->ficheinter->dir_output;
-			if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref;
+			if (! preg_match('/specimen/i',$fichref)) $dir.= "/" . $fichref;
 			$file = $dir . "/" . $fichref . ".pdf";
 
 			if (! file_exists($dir))
diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php
index 4143435aeb3638d2657cbc41a595b9bf535d1b49..5e1a894b8992643361f0c832b1966760a6c87979 100644
--- a/htdocs/includes/modules/import/import_csv.modules.php
+++ b/htdocs/includes/modules/import/import_csv.modules.php
@@ -331,7 +331,7 @@ class ImportCsv extends ModeleImports
 						// Make some tests
 
 						// Required field is ok
-						if (eregi('\*',$objimport->array_import_fields[0][$val]) && ($newval==''))
+						if (preg_match('/\*/',$objimport->array_import_fields[0][$val]) && ($newval==''))
 						{
 							$this->errors[$error]['lib']=$langs->trans('ErrorMissingMandatoryValue',$key);
 							$this->errors[$error]['type']='NOTNULL';
@@ -340,7 +340,7 @@ class ImportCsv extends ModeleImports
 						}
 						// Test format only if field is not a missing mandatory field
 						else {
-							if (! empty($objimport->array_import_regex[0][$val]) && ! eregi($objimport->array_import_regex[0][$val],$newval))
+							if (! empty($objimport->array_import_regex[0][$val]) && ! preg_match('/'.$objimport->array_import_regex[0][$val].'/i',$newval))
 							{
 								$this->errors[$error]['lib']=$langs->trans('ErrorWrongValueForField',$key,$newval,$objimport->array_import_regex[0][$val]);
 								$this->errors[$error]['type']='REGEX';
diff --git a/htdocs/includes/modules/import/modules_import.php b/htdocs/includes/modules/import/modules_import.php
index 9442cde9797fa360a9c5ebaca1b0210e16a50f24..43f588332f16794e70c49c036425c62c5de2b5de 100644
--- a/htdocs/includes/modules/import/modules_import.php
+++ b/htdocs/includes/modules/import/modules_import.php
@@ -66,7 +66,7 @@ class ModeleImports
 		$i=0;
 		while (($file = readdir($handle))!==false)
 		{
-			if (eregi("^import_(.*)\.modules\.php",$file,$reg))
+			if (preg_match("/^import_(.*)\.modules\.php/i",$file,$reg))
 			{
 				$moduleid=$reg[1];
 
diff --git a/htdocs/includes/modules/livraison/mod_livraison_jade.php b/htdocs/includes/modules/livraison/mod_livraison_jade.php
index 02c3b93dd3b10953f4dd6ba59a0ff556646af05a..22ebd0db858c70f928b6b6cb269d03a1bddc2b44 100644
--- a/htdocs/includes/modules/livraison/mod_livraison_jade.php
+++ b/htdocs/includes/modules/livraison/mod_livraison_jade.php
@@ -82,7 +82,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
         }
     
         // Si au moins un champ respectant le modele a ete trouvee
-        if (eregi('BL[0-9][0-9]',$blyy))
+        if (preg_match('/BL[0-9][0-9]/i',$blyy))
         {
             // Recherche rapide car restreint par un like sur champ indexe
             $posindice=5;
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
index 6931f3c31473f5a501eef7299b9fc9c98964862b..b5bc1076bcdab5567e5c1ea2f9b0001d32922e2c 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -123,7 +123,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
 
 			$objectref = dol_sanitizeFileName($object->ref);
 			$dir = $conf->expedition->dir_output."/receipt";
-			if (! eregi('specimen',$objectref)) $dir.= "/" . $objectref;
+			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
 			$file = $dir . "/" . $objectref . ".pdf";
 
 			if (! file_exists($dir))
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index ef17545a7de15873c2616ea0d4073e290a3fb6f2..456fb32585b93e1ea7ac5231784f7c27f3c81de9 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -144,7 +144,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
 
 			$objectref = dol_sanitizeFileName($object->ref);
 			$dir = $conf->expedition->dir_output."/receipt";
-			if (! eregi('specimen',$objectref)) $dir.= "/" . $objectref;
+			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
 			$file = $dir . "/" . $objectref . ".pdf";
 
 			if (! file_exists($dir))
diff --git a/htdocs/includes/modules/modExternalRss.class.php b/htdocs/includes/modules/modExternalRss.class.php
index 28369e7efdcb0efd19a7483ccabdd6f3fba899fe..1e75d5a850f54abe60199ebd8f2db849d6977234 100644
--- a/htdocs/includes/modules/modExternalRss.class.php
+++ b/htdocs/includes/modules/modExternalRss.class.php
@@ -103,7 +103,7 @@ class modExternalRss extends DolibarrModules
 		{
 			while ($obj = $this->db->fetch_object($result))
 			{
-				if (eregi('EXTERNAL_RSS_TITLE_([0-9]+)',$obj->name,$reg))
+				if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i',$obj->name,$reg))
 				{
 					// Definie la boite si on a trouvee une ancienne configuration
 					$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)";
diff --git a/htdocs/includes/modules/propale/mod_propale_marbre.php b/htdocs/includes/modules/propale/mod_propale_marbre.php
index 1863b62a114bb3b58ccf3a02b558f03a6895802b..c8b68a8be12238d57b4a02694da7b2051b9f7f90 100644
--- a/htdocs/includes/modules/propale/mod_propale_marbre.php
+++ b/htdocs/includes/modules/propale/mod_propale_marbre.php
@@ -79,7 +79,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
             $row = $db->fetch_row($resql);
             if ($row) $pryymm = substr($row[0],0,6);
         }
-        if (! $pryymm || eregi('PR[0-9][0-9][0-9][0-9]',$pryymm))
+        if (! $pryymm || preg_match('/PR[0-9][0-9][0-9][0-9]/i',$pryymm))
         {
             return true;
         }
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 63d994c223349e6e35546907de8805f79699293d..0f6831b2c3db1a49e796624ca6f1dcea66882872 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -597,7 +597,7 @@ class pdf_propale_azur extends ModelePDFPropales
 					$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
 
 					$tvacompl='';
-					if (eregi('\*',$tvakey))
+					if (preg_match('/\*/',$tvakey))
 					{
 						$tvakey=str_replace('*','',$tvakey);
 						$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
diff --git a/htdocs/includes/modules/societe/mod_codeclient_elephant.php b/htdocs/includes/modules/societe/mod_codeclient_elephant.php
index d913267f529cfb55af1e717c94c217565a953b1d..e992e38896d9e8b03fcc8f6489435e4197e424c2 100644
--- a/htdocs/includes/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/includes/modules/societe/mod_codeclient_elephant.php
@@ -187,10 +187,10 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
 		global $conf;
 
 		$mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER;
-		if (eregi('\{pre\}',$mask)) return 1;
+		if (preg_match('/\{pre\}/i',$mask)) return 1;
 
 		$mask = $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER;
-		if (eregi('\{pre\}',$mask)) return 1;
+		if (preg_match('/\{pre\}/i',$mask)) return 1;
 
 		return 0;
 	}
diff --git a/htdocs/includes/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/includes/modules/supplier_order/mod_commande_fournisseur_muguet.php
index e083768c51505edaa89644381a2968a5f86ec824..8d943a42d4ab8cbd881dd0a2f92a4a6a12ae1904 100644
--- a/htdocs/includes/modules/supplier_order/mod_commande_fournisseur_muguet.php
+++ b/htdocs/includes/modules/supplier_order/mod_commande_fournisseur_muguet.php
@@ -76,7 +76,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
             $row = $db->fetch_row($resql);
             if ($row) $coyymm = substr($row[0],0,6);
         }
-        if (! $coyymm || eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$coyymm))
+        if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm))
         {
             return true;
         }
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 451d3a0475aaedf0ea36080320809f7a568340f3..aa1b10a225e146e70461fbf8a2c1047ae29974b9 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -451,7 +451,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
 
 				$tvacompl='';
 
-				if (eregi('\*',$tvakey))
+				if (preg_match('/\*/',$tvakey))
 				{
 					$tvakey=str_replace('*','',$tvakey);
 					$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
diff --git a/htdocs/includes/nusoap/lib/class.soap_server.php b/htdocs/includes/nusoap/lib/class.soap_server.php
index e9d1644ef976cbe37e539f93df8c5ecab4ade253..88eca9f32b606b6f6c87155d59d1e44a2c91b7f9 100644
--- a/htdocs/includes/nusoap/lib/class.soap_server.php
+++ b/htdocs/includes/nusoap/lib/class.soap_server.php
@@ -316,7 +316,7 @@ class nusoap_server extends nusoap_base {
 			// get the character encoding of the incoming request
 			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
 				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
-				if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+				if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 					$this->xml_encoding = strtoupper($enc);
 				} else {
 					$this->xml_encoding = 'US-ASCII';
@@ -345,7 +345,7 @@ class nusoap_server extends nusoap_base {
 						$enc = substr(strstr($v, '='), 1);
 						$enc = str_replace('"', '', $enc);
 						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
 							$this->xml_encoding = strtoupper($enc);
 						} else {
 							$this->xml_encoding = 'US-ASCII';
@@ -379,7 +379,7 @@ class nusoap_server extends nusoap_base {
 						$enc = substr(strstr($v, '='), 1);
 						$enc = str_replace('"', '', $enc);
 						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
 							$this->xml_encoding = strtoupper($enc);
 						} else {
 							$this->xml_encoding = 'US-ASCII';
@@ -805,7 +805,7 @@ class nusoap_server extends nusoap_base {
 		if (strpos($headers['content-type'], '=')) {
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
 			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 				$this->xml_encoding = strtoupper($enc);
 			} else {
 				$this->xml_encoding = 'US-ASCII';
diff --git a/htdocs/includes/nusoap/lib/class.soapclient.php b/htdocs/includes/nusoap/lib/class.soapclient.php
index f828aa7812147d308c9d0a0afaa3b88c0dcbd221..3fe15fad6e2a94a4d991573effb0e834b5e45a9a 100644
--- a/htdocs/includes/nusoap/lib/class.soapclient.php
+++ b/htdocs/includes/nusoap/lib/class.soapclient.php
@@ -490,7 +490,7 @@ class nusoap_client extends nusoap_base  {
 		if (strpos($headers['content-type'], '=')) {
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
 			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 				$this->xml_encoding = strtoupper($enc);
 			} else {
 				$this->xml_encoding = 'US-ASCII';
diff --git a/htdocs/includes/nusoap/lib/nusoap.php b/htdocs/includes/nusoap/lib/nusoap.php
index 34af56b7ddbc03d4214197f217c7dc85a0d700d8..6cb65e8f6dd1e91c82ce07a391fa82bf8378c641 100644
--- a/htdocs/includes/nusoap/lib/nusoap.php
+++ b/htdocs/includes/nusoap/lib/nusoap.php
@@ -3725,7 +3725,7 @@ class nusoap_server extends nusoap_base {
 			// get the character encoding of the incoming request
 			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
 				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
-				if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+				if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 					$this->xml_encoding = strtoupper($enc);
 				} else {
 					$this->xml_encoding = 'US-ASCII';
@@ -3754,7 +3754,7 @@ class nusoap_server extends nusoap_base {
 						$enc = substr(strstr($v, '='), 1);
 						$enc = str_replace('"', '', $enc);
 						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
 							$this->xml_encoding = strtoupper($enc);
 						} else {
 							$this->xml_encoding = 'US-ASCII';
@@ -3788,7 +3788,7 @@ class nusoap_server extends nusoap_base {
 						$enc = substr(strstr($v, '='), 1);
 						$enc = str_replace('"', '', $enc);
 						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
 							$this->xml_encoding = strtoupper($enc);
 						} else {
 							$this->xml_encoding = 'US-ASCII';
@@ -4214,7 +4214,7 @@ class nusoap_server extends nusoap_base {
 		if (strpos($headers['content-type'], '=')) {
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
 			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 				$this->xml_encoding = strtoupper($enc);
 			} else {
 				$this->xml_encoding = 'US-ASCII';
@@ -7506,7 +7506,7 @@ class nusoap_client extends nusoap_base  {
 		if (strpos($headers['content-type'], '=')) {
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
 			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
 				$this->xml_encoding = strtoupper($enc);
 			} else {
 				$this->xml_encoding = 'US-ASCII';
diff --git a/htdocs/includes/php_writeexcel/class.writeexcel_formula.inc.php b/htdocs/includes/php_writeexcel/class.writeexcel_formula.inc.php
index 682a122f5ec37bed0a16fe0a538bd07a51547d5d..7ae1881e4970c30cdf1b2d66d4e7e3de9971df13 100644
--- a/htdocs/includes/php_writeexcel/class.writeexcel_formula.inc.php
+++ b/htdocs/includes/php_writeexcel/class.writeexcel_formula.inc.php
@@ -1436,7 +1436,7 @@ function _fact()
         $this->_advance();
         return $result;
     }
- elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token))
+ elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
  {
     // if it's a function call
         $result = $this->_func();