From 37c2825f933c63a0560aa0f248e185f052d9b79a Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Thu, 22 Oct 2009 15:09:04 +0000
Subject: [PATCH] Fix: functions "ereg", "ereg_replace", "eregi",
 "eregi_replace" is deprecated since php 5.3.0

---
 htdocs/bookmarks/fiche.php                    |  4 +-
 htdocs/cashdesk/include/environnement.php     |  2 +-
 htdocs/categories/index.php                   |  2 +-
 htdocs/categories/photos.php                  |  2 +-
 htdocs/comm/action/fiche.php                  |  2 +-
 htdocs/comm/action/index.php                  |  2 +-
 htdocs/comm/mailing/cibles.php                |  2 +-
 htdocs/comm/mailing/fiche.php                 |  4 +-
 htdocs/comm/mailing/index.php                 |  2 +-
 htdocs/commande/commande.class.php            |  4 +-
 htdocs/compta/bank/account.class.php          |  2 +-
 htdocs/compta/bank/account.php                |  8 ++--
 htdocs/compta/bank/annuel.php                 |  4 +-
 htdocs/compta/bank/graph.php                  |  4 +-
 htdocs/compta/bank/ligne.php                  |  4 +-
 htdocs/compta/bank/rappro.php                 | 16 ++++----
 htdocs/compta/bank/releve.php                 |  2 +-
 htdocs/compta/bank/search.php                 |  2 +-
 htdocs/compta/paiement/rapport.php            |  6 +--
 htdocs/compta/resultat/index.php              | 12 +++---
 htdocs/core/conf.class.php                    | 14 +++----
 htdocs/core/menubase.class.php                | 10 ++---
 htdocs/ecm/index.php                          |  8 ++--
 htdocs/fourn/commande/dispatch.php            |  2 +-
 htdocs/fourn/commande/fiche.php               |  2 +-
 htdocs/fourn/facture/paiementfourn.class.php  |  2 +-
 htdocs/fourn/fournisseur.commande.class.php   |  2 +-
 htdocs/imports/import.php                     |  8 ++--
 .../barcode/php-barcode/encode_bars.php       |  2 +-
 .../barcode/php-barcode/php-barcode.php       | 10 ++---
 htdocs/includes/fpdf/fpdf/fpdf.php            | 10 ++---
 .../menus/barre_left/auguria_backoffice.php   |  4 +-
 .../menus/barre_left/auguria_frontoffice.php  |  4 +-
 .../menus/barre_left/eldy_backoffice.php      | 38 +++++++++----------
 .../menus/barre_left/eldy_frontoffice.php     | 38 +++++++++----------
 .../menus/barre_top/auguria_backoffice.php    |  2 +-
 .../menus/barre_top/auguria_frontoffice.php   |  6 +--
 .../menus/barre_top/eldy_backoffice.php       |  6 +--
 .../menus/barre_top/eldy_frontoffice.php      |  6 +--
 htdocs/includes/menus/barre_top/empty.php     |  2 +-
 htdocs/includes/menus/barre_top/rodolphe.php  |  4 +-
 .../modules/DolibarrModules.class.php         |  6 +--
 .../modules/commande/mod_commande_marbre.php  |  2 +-
 .../modules/commande/pdf_einstein.modules.php |  2 +-
 .../modules/export/export_csv.modules.php     |  2 +-
 .../modules/export/export_excel.modules.php   |  6 +--
 .../modules/export/export_tsv.modules.php     |  2 +-
 .../modules/export/modules_export.php         |  2 +-
 .../modules/facture/pdf_crabe.modules.php     |  2 +-
 .../modules/facture/pdf_oursin.modules.php    |  2 +-
 .../modules/facture/terre/terre.modules.php   |  4 +-
 .../modules/fichinter/mod_pacific.php         | 20 +++++-----
 .../modules/fichinter/pdf_soleil.modules.php  |  2 +-
 .../modules/import/import_csv.modules.php     |  4 +-
 .../modules/import/modules_import.php         |  2 +-
 .../modules/livraison/mod_livraison_jade.php  |  2 +-
 .../livraison/pdf/pdf_sirocco.modules.php     |  2 +-
 .../livraison/pdf/pdf_typhon.modules.php      |  2 +-
 .../includes/modules/modExternalRss.class.php |  2 +-
 .../modules/propale/mod_propale_marbre.php    |  2 +-
 .../propale/pdf_propale_azur.modules.php      |  2 +-
 .../societe/mod_codeclient_elephant.php       |  4 +-
 .../mod_commande_fournisseur_muguet.php       |  2 +-
 .../pdf/pdf_muscadet.modules.php              |  2 +-
 .../includes/nusoap/lib/class.soap_server.php |  8 ++--
 .../includes/nusoap/lib/class.soapclient.php  |  2 +-
 htdocs/includes/nusoap/lib/nusoap.php         | 10 ++---
 .../class.writeexcel_formula.inc.php          |  2 +-
 68 files changed, 183 insertions(+), 183 deletions(-)

diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php
index 55ac5dbec7a..79e978cc2de 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 398da6cb5ba..e3689f8004b 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 dda3ff6a2cc..28f3d72d6f6 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 823c33b07ac..73ee3ffba82 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 8b886509081..e71241ecccd 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 c8742ad0872..2b69a2d7a4e 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 0dc67d987ab..72aef1079a9 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 098f37d6cac..b281fd4a24d 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 47b6e340fc5..8bd2220982a 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 878359f6917..5e67f97afae 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 6459bdccce3..1a12d8450f4 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 c4ea9c3e01b..96f8e1243c3 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 21938a88b4a..fcca475d8c6 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 8179c62440b..442f49d1433 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 3004d934c88..371632dec97 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 341e21dab5e..c1b14c06aef 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 69468fa0c7b..b5a6fbb6128 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 c9df6c9e546..c9ea98d1df8 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 621da00f1f0..b8f44d72f7f 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 5ccfad1387b..fa727b9d7c9 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 3654703ef48..0fd8976ed09 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 22951118e81..52ca1de6d7f 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 31e2ff42ef8..80f85e27840 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 6296888dd94..7e5a6f0e25b 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 961c1696012..a809c5cb182 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 c99d671a23b..8af057bbbab 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 6a13a9f1f45..0e0ef024153 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 854d7fb10b4..0497875631d 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 c1fb5f0e7a8..c8ec8c5a026 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 19e9cf6beef..e370cda983c 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 3cfb11eef1f..cfb4a398dfb 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 c8c9072aa0f..d352d542981 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 7038552be1f..db3cfd89d72 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 9053d589759..bcf42a09e8b 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 0e007014775..31961e70aba 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 266e3b09eb9..ba03879b27e 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 61d86926aab..13bdaae6d7d 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 fc6424a7e93..07dfed3d796 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 9c1a3ed3d33..0d14b9d9a08 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 6462935c5e5..be0bef54554 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 f4a7c56d75c..e37d362211d 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 6aadcaf11ee..daac4463e22 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 34ae5b05f80..a099c25e3f0 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 795010e011e..ae3e41c8efe 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 ef2d359bc85..5e6653e3054 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 b5835c88032..8fa84c9e627 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 a9d7cd48ee4..7cf1a134312 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 5af5c80463e..96113f5f4ce 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 5ba3507ae13..076db0a9e17 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 c9ea75f5497..81b8ca653b4 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 0e6e0aacdaf..b36d9b3c4f4 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 7cea35f9d65..bdcd4ac9e35 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 71754459662..6e81bfaca91 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 4143435aeb3..5e1a894b899 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 9442cde9797..43f588332f1 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 02c3b93dd3b..22ebd0db858 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 6931f3c3147..b5bc1076bcd 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 ef17545a7de..456fb32585b 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 28369e7efdc..1e75d5a850f 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 1863b62a114..c8b68a8be12 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 63d994c2233..0f6831b2c3d 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 d913267f529..e992e38896d 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 e083768c515..8d943a42d4a 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 451d3a0475a..aa1b10a225e 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 e9d1644ef97..88eca9f32b6 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 f828aa78121..3fe15fad6e2 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 34af56b7ddb..6cb65e8f6dd 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 682a122f5ec..7ae1881e497 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();
-- 
GitLab