Replacing comma with Arabic decimal separator

by Manuel Souto Pico

HTML

<h1>Commas with Hindu-Arabic numerals (JS)</h1>
<p>This demo </p>
<table>
<tr>
  <th>Figure</th>
  <th>Description</th>
</tr>
<tr>
  <td class="figure">3,230</td>
  <td>Latin figure with regular comma (not altered)</td>
</tr>
<tr>
  <td class="figure">٣,٢٣٠</td>
  <td>Arabic figure originally with regular comma (updated on rendering)</td>
</tr>
<tr>
  <td class="figure">٣٫٢٣٠</td>
  <td>Arabic figure originally with Arabic decimal separator (not altered)</td>
</tr>
</table>
<p> The figures in the second and third rows should be identical.</p>

CSS

.figure {
  font-size: 3em;
  font-weight: bold;
}

table, table td, table th {
  border: 1px solid black;
  border-collapse: collapse;
  padding: 10px;
}

JavaScript

document.body.innerHTML = document.body.innerHTML.replace(/([٠-٩]),([٠-٩])/g,"$1٫$2");