If your system is in English, use this regex:
$(".mask").inputmask('Regex', {regex: "^[0-9]{1,6}(\\.\\d{1,2})?$"});
If your system is in Brazilian Portuguese, use this:
Import:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.2.6/jquery.inputmask.bundle.min.js"></script>
HTML:
<input class="mask" type="text" />
JS:
$(".mask").inputmask('Regex', {regex: "^[0-9]{1,6}(\\,\\d{1,2})?$"});
This is because in Brazilian Portuguese we write β1.000.000.00β rather than β1,000,000.00β, as in English, so if you use β.β the system will not understand the decimal point.
This is it, I hope this helps someone. I spend a lot of time to figure this out.
source share