You must Sign In to post a response.
  • Category: JavaScript

    ReqularExpression for currency format change

    Hi

    I need to format the value on keypress in the textbox.

    I need to add comma(,) for every 3 digit from the last.

    Currently I am having the regx like

    z[0] = z[0].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); //result 1,200,0033

    I am expecting "12,000,033"

    It will be helpful anybody give the exact Regx

    Thanks
  • #769533
    Hi Pugazh,

    You can do this auto format currency by using a jQuery plugin. Rather than validating with the regular expression, you can use that plugin.

    Demo for the plugin,
    https://www.jqueryscript.net/demo/Auto-Format-Currency-With-jQuery/

    Source and integration documentation,
    https://www.jqueryscript.net/other/Auto-Format-Currency-With-jQuery.html

    Regards,
    V.M. Damodharan
    "Your talent will be worthless, when you have fear and tension."


  • Sign In to post your comments