When replace characters in the replacement string is the use of javascript, found only replace the first character matches, the latter are not replaced.
"Aaaaaa" .replace ( "a", "b"); the returned string is baaaaa
Should be written
"aaaaaa".replace(/a/g,"b");