diff --git a/dev/fpdf/makefont/makefont.php b/dev/fpdf/makefont/makefont.php
index 3efca2508931e2cb5841ae9f8ef41d7bb0566653..07b530da5b08d81e50ea3bf3a80fc0a8f02e5c42 100644
--- a/dev/fpdf/makefont/makefont.php
+++ b/dev/fpdf/makefont/makefont.php
@@ -171,7 +171,7 @@ function MakeFontDescriptor($fm,$symbolic)
 	//StemV
 	if(isset($fm['StdVW']))
 		$stemv=$fm['StdVW'];
-	elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight']))
+	elseif(isset($fm['Weight']) and preg_match('/(bold|black)/i',$fm['Weight']))
 		$stemv=120;
 	else
 		$stemv=70;
diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php
index 28ba84e454505853c24bf754629f4e4b2df1cd9b..a7036c294395fa4931e0b53781558f5c67df949f 100644
--- a/dev/skeletons/build_class_from_table.php
+++ b/dev/skeletons/build_class_from_table.php
@@ -102,8 +102,8 @@ if ($resql)
 		{
 			$property[$i]['istime']=false;
 		}
-		if (eregi('varchar',$property[$i]['type'])
-			|| eregi('text',$property[$i]['type']))
+		if (preg_match('/varchar/i',$property[$i]['type'])
+			|| preg_match('/text/i',$property[$i]['type']))
 		{
 			$property[$i]['ischar']=true;
 		}
diff --git a/dev/translation/langAutoParser.class.php b/dev/translation/langAutoParser.class.php
index a33ea9fb30ef2f42d35065f4682e3adb62daa232..2f5e303bd93914ad9d08c4e60ebe987b6c96a295 100644
--- a/dev/translation/langAutoParser.class.php
+++ b/dev/translation/langAutoParser.class.php
@@ -154,7 +154,7 @@ FILE_SKIP_EMPTY_LINES);
 	private function getTranslationFilesArray($lang){
 		$dir = new DirectoryIterator($this->langDir.$lang);
 		while($dir->valid()) {
-			if(!$dir->isDot() && $dir->isFile() && ! eregi('^\.',$dir->getFilename())) {
+			if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
 				$files[] =  $dir->getFilename();
 			}
 			$dir->next();
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 1609bd550adbcec1c5ff48c7aeaf632521df27e8..ace88e753c42c3bf198d6fd872c10bdb73f4b547 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -221,7 +221,7 @@ print "</div>\n";
 
 if ($errmsg)
 {
-	if (eregi('^Error',$errmsg))
+	if (preg_match('/^Error/i',$errmsg))
 	{
 		$langs->load("errors");
 		$errmsg=$langs->trans($errmsg);
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 4b23fdce4a3d8556bf1fac25850befaedd989c44..871add6cfb58c856e7a64966c8904d728c0ac22f 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -97,7 +97,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
 			{
 				if (is_readable($dir.$file))
 				{
-					if (eregi('(.*)\.modules\.php$',$file,$reg))
+					if (preg_match('/(.*)\.modules\.php$/i',$file,$reg))
 					{
 						$filebis=$reg[1];
 
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index dbb79c53b0f698523ee99f0afa11e9bc9a14b934..850548e80c7ad37d4763060dd436d56f868ca775 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -194,13 +194,13 @@ if ($resql)
 			{
 				if (strlen($record['box_order']) == 1)
 				{
-					if (eregi("[13579]{1}",substr($record['box_order'],-1)))
+					if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
 					{
 						$box_order = "A0".$record['box_order'];
 						$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
 						$resql = $db->query($sql);
 					}
-					else if (eregi("[02468]{1}",substr($record['box_order'],-1)))
+					else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
 					{
 						$box_order = "B0".$record['box_order'];
 						$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
@@ -209,13 +209,13 @@ if ($resql)
 				}
 				else if (strlen($record['box_order']) == 2)
 				{
-					if (eregi("[13579]{1}",substr($record['box_order'],-1)))
+					if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
 					{
 						$box_order = "A".$record['box_order'];
 						$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
 						$resql = $db->query($sql);
 					}
-					else if (eregi("[02468]{1}",substr($record['box_order'],-1)))
+					else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
 					{
 						$box_order = "B".$record['box_order'];
 						$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 777f188e2e3d5b0c79407fee19ee444b0a595293..f09a7ad66f7f37930d4ba832bea5c30a1fdaccd3 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -329,7 +329,7 @@ $handle=opendir($dir);
 $var=true;
 while (($file = readdir($handle))!==false)
 {
-	if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+	if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
 	{
 		$name = substr($file, 4, strlen($file) -16);
 		$classname = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 3dc3b096a0a24980bce876f81b61d676c8c414c7..97d46a191f156bd5d16aae07a532d4f48be03d88 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -55,7 +55,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
 	dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
 	if ($_FILES["logo"]["tmp_name"])
 	{
-		if (eregi('([^\\\/:]+)$',$_FILES["logo"]["name"],$reg))
+		if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
 		{
 			$original_file=$reg[1];
 
@@ -77,7 +77,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
 						$quality = 80;
 
 						$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 200, 100, '_small', $quality);
-						if (eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
+						if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
 						{
 							$imgThumbSmall = $reg[1];
 							dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
@@ -86,7 +86,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
 
 						// Creation de la vignette de la page "Societe/Institution"
 						$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 100, 30, '_mini', $quality);
-						if (eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
+						if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
 						{
 							$imgThumbMini = $reg[1];
 							dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
@@ -137,7 +137,7 @@ if ($_GET["action"] == 'addthumb')
 		{
 			// Creation de la vignette de la page login
 			$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 200, 100, '_small',80);
-			if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
+			if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
 			{
 				$imgThumbSmall = $reg[1];
 				dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
@@ -146,7 +146,7 @@ if ($_GET["action"] == 'addthumb')
 
 			// Creation de la vignette de la page "Societe/Institution"
 			$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 100, 30, '_mini',80);
-			if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
+			if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
 			{
 				$imgThumbMini = $reg[1];
 				dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
@@ -551,7 +551,7 @@ else
 	print '</td><td valign="center" align="right">';
 
 	// On propose la generation de la vignette si elle n'existe pas
-	if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && eregi('(\.jpg|\.jpeg|\.png)$',$mysoc->logo))
+	if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
 	{
 		print '<a href="'.$_SERVER["PHP_SELF"].'?action=addthumb&amp;file='.urlencode($mysoc->logo).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
 	}
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 7fc9d4bb74ad2ea60ebb905cfed28a37ae5b8576..9338f36ea577750b8459063bf4d7b7b492da1042 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -670,7 +670,7 @@ if ($_GET["id"])
 					print '<td align="center" nowrap="nowrap">';
 					// Est-ce une entree du dictionnaire qui peut etre desactivee ?
 					$iserasable=1;  // Oui par defaut
-					if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || eregi('unknown',$obj->code))) $iserasable=0;
+					if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0;
 					if ($obj->type && $obj->type == 'system') $iserasable=0;
 
 					if ($iserasable) {
diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php
index 185d98e679d0498ca6f30299dcfc0444a67a604b..ea8d19efc9aeeb6b8c7d4c470a9b276547c73eb7 100644
--- a/htdocs/admin/dons.php
+++ b/htdocs/admin/dons.php
@@ -179,7 +179,7 @@ $handle=opendir($dir);
 $var=True;
 while (($file = readdir($handle))!==false)
 {
-    if (eregi('\.modules\.php$',$file))
+    if (preg_match('/\.modules\.php$/i',$file))
     {
         $var = !$var;
         $name = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php
index 4130eaf074fcff742b70e3a98ed27064ff6d002f..f978d34f418be2facb5395ec6be25dc024f15741 100644
--- a/htdocs/admin/external_rss.php
+++ b/htdocs/admin/external_rss.php
@@ -46,7 +46,7 @@ $result=$db->query($sql);
 if ($result)
 {
     $obj = $db->fetch_object($result);
-    eregi('([0-9]+)$',$obj->name,$reg);
+    preg_match('/([0-9]+)$/i',$obj->name,$reg);
 	if ($reg[1]) $lastexternalrss = $reg[1];
 }
 else
@@ -238,7 +238,7 @@ if ($resql)
 	{
 		$obj = $db->fetch_object($resql);
 
-	    eregi('^([0-9]+)',$obj->note,$reg);
+	    preg_match('/^([0-9]+)/i',$obj->note,$reg);
 		$idrss = $reg[1];
 		//print "x".$idrss;
 
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index dd49954c277a3bec4142712f6fdd3fca63f097e1..5a56b90c369331e373e390565fc3864353baac78 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -387,7 +387,7 @@ $handle=opendir($dir);
 $var=True;
 while (($file = readdir($handle))!==false)
 {
-    if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+    if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
     {
         $var = !$var;
         $name = substr($file, 4, strlen($file) -16);
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index 9332fc29ba9ecb279a443881088ceabfb4ee592b..0ba3004facddfbabcc2d268228706f1d08e68c76 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -198,7 +198,7 @@ if ($handle)
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (eregi('^(mod_.*)\.php$',$file,$reg))
+		if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
 		{
 			$file = $reg[1];
 			$className = substr($file,4);
diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index 31e6738c17671c71f9a5bafc66807fba0de5ae19..224b8c9a199f9e5284ed7ed6f360e29bbe19325c 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -308,7 +308,7 @@ $handle=opendir($dir);
 $var=true;
 while (($file = readdir($handle))!==false)
 {
-	if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+	if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
 	{
 		$name = substr($file, 4, strlen($file) -16);
 		$classname = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/ftpclient.php b/htdocs/admin/ftpclient.php
index 3fd4c0bf27edebc5b0601d90b94a5fb7bbfa10ab..6680759dab68d320008c2a1d8c0a76ff140244b6 100644
--- a/htdocs/admin/ftpclient.php
+++ b/htdocs/admin/ftpclient.php
@@ -41,7 +41,7 @@ $result=$db->query($sql);
 if ($result)
 {
     $obj = $db->fetch_object($result);
-    eregi('([0-9]+)$',$obj->name,$reg);
+    preg_match('/([0-9]+)$/i',$obj->name,$reg);
 	if ($reg[1]) $lastftpentry = $reg[1];
 }
 else
@@ -217,7 +217,7 @@ else
 		{
 			$obj = $db->fetch_object($resql);
 
-		    eregi('([0-9]+)$',$obj->name,$reg);
+		    preg_match('/([0-9]+)$/i',$obj->name,$reg);
 			$idrss = $reg[0];
 			//print "x".join(',',$reg)."=".$obj->name."=".$idrss;
 
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index caea7e64f4c06889cc8efeaab0461c4d499f47f2..2720549d79b169bb4ab7f0f463103f483ab883c1 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -175,8 +175,8 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
  */
 
 $linuxlike=1;
-if (eregi('^win',PHP_OS)) $linuxlike=0;
-if (eregi('^mac',PHP_OS)) $linuxlike=0;
+if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
+if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
 
 
 if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index bf3ccfb4a399593daabf3951aad6f32643205598..abd6a3af5d1815e06a485961c7a859c3636609b7 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -409,7 +409,7 @@ foreach ($orders as $key => $value)
         print '  <td valign="top" width="14" align="center">';
         if (! empty($objMod->picto))
         {
-        	if (eregi('^/',$objMod->picto)) print img_picto('',$objMod->picto,'',1);
+        	if (preg_match('/^\//i',$objMod->picto)) print img_picto('',$objMod->picto,'',1);
         	else print img_object('',$objMod->picto);
         }
         else
diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php
index 9ebd0d98ad23fe578820c90680d11426f907eb2e..245d458eac2a28f89a8e8204fd15cf14d7ec864c 100644
--- a/htdocs/admin/security.php
+++ b/htdocs/admin/security.php
@@ -190,9 +190,9 @@ $handle=opendir($dir);
 $i=1;
 while (($file = readdir($handle))!==false)
 {
-    if (eregi('(modGeneratePass[a-z]+).class.php',$file,$reg))
+    if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
     {
-        // Chargement de la classe de num�rotation
+        // Chargement de la classe de numerotation
         $classname = $reg[1];
         require_once($dir.'/'.$file);
 
@@ -299,7 +299,7 @@ $var=!$var;
 print "<tr ".$bc[$var].">";
 print '<td colspan="3">'.$langs->trans("MainDbPasswordFileConfEncrypted").'</td>';
 print '<td align="center" width="60">';
-if (eregi('crypted:',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
+if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
 {
 	print img_tick();
 }
diff --git a/htdocs/admin/system/database-tables-contraintes.php b/htdocs/admin/system/database-tables-contraintes.php
index f059bc52058f25024dcac48097804c43868c8125..4d4b1d55a0e70f58d74fd816fb1cc32531ae0b94 100644
--- a/htdocs/admin/system/database-tables-contraintes.php
+++ b/htdocs/admin/system/database-tables-contraintes.php
@@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("Constraints"),'','setup');
 
 // Define request to get table description
 $base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
 {
     $sql = "SHOW TABLE STATUS";
     $base=1;
diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php
index 40c90907219850da21c7a2df4105dfc5767bc943..dfa5f8df46fd5bebf9bb0d924034145e7604d19b 100644
--- a/htdocs/admin/system/database-tables.php
+++ b/htdocs/admin/system/database-tables.php
@@ -51,7 +51,7 @@ print_fiche_titre($langs->trans("Tables")." ".ucfirst($conf->db->type),'','setup
 
 // Define request to get table description
 $base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
 {
 	$sql = "SHOW TABLE STATUS";
 	$base=1;
diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php
index dd05b6736c27b0ca56a8c3423db44fc0916e6d99..dbd68c399bb9ef8acf1c2c36eec7e6628a5f9a13 100644
--- a/htdocs/admin/system/database.php
+++ b/htdocs/admin/system/database.php
@@ -96,7 +96,7 @@ else
 
 		// arraytest is an array of test to do
 		$arraytest=array();
-		if (eregi('mysql',$db->type))
+		if (preg_match('/mysql/i',$db->type))
 		{
 			$arraytest=array(
 //				"character_set_connection"=>'UTF-8',
diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php
index 45a0c984f973e94579f7e5bc4e4cc9cecf63ee45..ef0b89091f5e88ddd8133dfd3326466c01c98adf 100644
--- a/htdocs/admin/system/dbtable.php
+++ b/htdocs/admin/system/dbtable.php
@@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("Table") . " ".$_GET["table"],'','setup');
 
 // Define request to get table description
 $base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
 {
 	$sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'";
 	$base=1;
diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php
index d90dd5b80d98933d3c06b034f0967c0560935e43..56e50b839053d0cabad14e6f993955970991afd1 100644
--- a/htdocs/admin/system/modules.php
+++ b/htdocs/admin/system/modules.php
@@ -92,7 +92,7 @@ foreach($sortorder as $numero=>$name)
 	$alt=$name.' - '.$modules_files[$numero];
     if (! empty($picto[$numero]))
     {
-       	if (eregi('^/',$picto[$numero])) print img_picto($alt,$picto[$numero],'',1);
+       	if (preg_match('/^\//',$picto[$numero])) print img_picto($alt,$picto[$numero],'',1);
        	else print img_object($alt,$picto[$numero]);
     }
     else
diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php
index 16fd81eb6940cb1ae7f91eb91cdaddcf3137f23e..01e2d8146703fa67eec022a4a073587ac4d06d28 100644
--- a/htdocs/admin/system/os.php
+++ b/htdocs/admin/system/os.php
@@ -42,15 +42,15 @@ print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
 print "\n";
 
-// R�cup�re l'OS au sens PHP
+// Recupere l'OS au sens PHP
 print "<tr $bc[0]><td width=\"240\">".$langs->trans("PHP_OS")."</td><td>".PHP_OS."</td></tr>\n";
 
-// R�cup�re la version de l'OS
+// Recupere la version de l'OS
 ob_start();
 phpinfo();
 $chaine = ob_get_contents();
 ob_end_clean();
-eregi('System </td><td class="v">([^\/]*)</td>',$chaine,$reg);
+preg_match('/System <\/td><td class="v">([^\\/]*)<\/td>/i',$chaine,$reg);
 print "<tr $bc[1]><td width=\"240\">".$langs->trans("Version")."</td><td>".$reg[1]."</td></tr>\n";
 print '</table>';
 
diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php
index 6ff920e3b2c1d785b2a5752b42ee47a67eb47d17..3e588248af6b274b05495dbb3ee5d3ebb251775d 100644
--- a/htdocs/admin/tools/dolibarr_import.php
+++ b/htdocs/admin/tools/dolibarr_import.php
@@ -100,7 +100,7 @@ print '<br>';
 	<?php
 	// Parameteres execution
 	$command='mysql';
-	if (eregi(" ",$command)) $command=$command=escapeshellarg($command);	// Use quotes on command
+	if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command);	// Use quotes on command
 
 	$param=$dolibarr_main_db_name;
 	$param.=" -h ".$dolibarr_main_db_host;
diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php
index 51b38fd08005a93be47873ccb20f68f86521c049..9d27dde70d338ff97f6da86a4dd1d072de7669c6 100644
--- a/htdocs/admin/tools/export.php
+++ b/htdocs/admin/tools/export.php
@@ -89,7 +89,7 @@ if ($what == 'mysql')
 
 	// Parameteres execution
 	$command=$mysqldump;
-	if (eregi(" ",$command)) $command=$command=escapeshellarg($command);	// Use quotes on command
+	if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command);	// Use quotes on command
 
 	//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
 	$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
@@ -188,7 +188,7 @@ if ($what == 'mysql')
 		if ($compression == 'none') fclose($handle);
 		if ($compression == 'gz')   gzclose($handle);
 		if ($compression == 'bz')   bzclose($handle);
-		if (eregi('^-- MySql',$errormsg)) $errormsg='';	// Pas erreur
+		if (preg_match('/^-- MySql/i',$errormsg)) $errormsg='';	// Pas erreur
 		else
 		{
 			// Renommer fichier sortie en fichier erreur
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index 16d53cbf6ae59376a69fcc09bf05d1a8ff0ac6a3..403ab5763b1fb84f3e2c3f4588e45fccb637ebf4 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -186,7 +186,7 @@ if ($result)
 		// Description
 		print '<td>';
 		$text=$langs->trans($obj->description);
-		if (eregi('\((.*)\)',$obj->description,$reg))
+		if (preg_match('/\((.*)\)/i',$obj->description,$reg))
 		{
 			$val=explode(',',$reg[1]);
 			$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php
index d1b92d144396711bb9f1456c4e909f6f93d05b6d..f73c2d00d11bafe3a4107f96e8a198e8e5c97e3f 100644
--- a/htdocs/admin/tools/purge.php
+++ b/htdocs/admin/tools/purge.php
@@ -45,7 +45,7 @@ if ($conf->syslog->enabled)
 /*
  *	Actions
  */
-if ($_REQUEST["action"]=='purge' && ! eregi('^confirm',$_REQUEST["choice"]) && ($_REQUEST["choice"] != 'allfiles' || $_REQUEST["confirm"] == 'yes') )
+if ($_REQUEST["action"]=='purge' && ! preg_match('/^confirm/i',$_REQUEST["choice"]) && ($_REQUEST["choice"] != 'allfiles' || $_REQUEST["confirm"] == 'yes') )
 {
 	$filesarray=array();
 
@@ -163,7 +163,7 @@ if ($message)
 	print "\n";
 }
 
-if (eregi('^confirm',$_REQUEST["choice"]))
+if (preg_match('/^confirm/i',$_REQUEST["choice"]))
 {
 	print '<br>';
 	$formquestion=array();
diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php
index 040b717766a0b271f913381cd900aae5863b90b7..a422ff4b36bef195b249f0147a2d8ccad0f9e8db 100644
--- a/htdocs/admin/triggers.php
+++ b/htdocs/admin/triggers.php
@@ -185,8 +185,8 @@ foreach ($orders as $key => $value)
     $disabledbyname=0;
     $disabledbymodule=1;
 	$module='';
-    if (eregi('NORUN$',$files[$key])) $disabledbyname=1;
-    if (eregi('^interface_([^_]+)_(.+)\.class\.php',$files[$key],$reg))
+    if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1;
+    if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg))
 	{
 		// Check if trigger file is for a particular module
 		$module=preg_replace('/^mod/i','',$reg[1]);