diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 041235f40f6..4a9d25aefde 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -4704,8 +4704,13 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
$pattern = "/<[^<>]+>/";
$StringHtml = preg_replace('/
]*>/', "\n", $StringHtml);
$temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto);
- $temp = preg_replace($pattern,"",$temp);
+ // Exemple of $temp: 0000-021
+ $temp = preg_replace($pattern,"",$temp); // pass 1
+ // $temp after pass 1: 0000-021
+ $temp = preg_replace($pattern,"",$temp); // pass 2
+ // $temp after pass 2: 0000-021
+
// Supprime aussi les retours
if ($removelinefeed) $temp=str_replace(array("\r\n","\r","\n")," ",$temp);
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index 8c57e8a178a..4e98ce0b3bc 100644
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -377,6 +377,14 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$after=dol_string_nohtmltag($text,1);
$this->assertEquals("A string Another string",$after,"test5");
+ $text='ABC';
+ $after=dol_string_nohtmltag($text,1);
+ $this->assertEquals("ABC",$after,"test6");
+
+ $text='DEF';
+ $after=dol_string_nohtmltag($text,1);
+ $this->assertEquals("DEF",$after,"test7");
+
return true;
}