Regular expression for Indian Currency validation using JavaScript

regular expression currency with commas and decimal
regex validate currency
regex price format
indian currency format javascript
regex for currency symbol
regular expression match
regex for amount validation
javascript regex to add commas to number

Can anyone please tell me how to check whether the entered amount (Indian currency) in a textbox is valid or not using regular expression?

I have few conditions..

  1. The amount should not contain more than 1 decimal point, but can have a single decimal point.
  2. If there is a decimal point then it should be followed by one or more digits.
  3. The amount should have only numbers and at most one decimal point.
  4. If I enter an amount like 10.000 then it should not be accepted because it has 3 continuous zeros after decimal point. but 56.8906 should be accepted.
  5. If the amount starts with zero (ie 0123) it should not be accepted, but 0.0 should be accepted

should do what you want.


^         # Start of string.
(?:       # Try to match...
 0        # either a 0
|         # or
[1-9]\d*  # an integer number > 0, no leading 0 allowed.
)         # End of integer part.
(?:       # Try to match...
 \.       # a decimal point.
 (?!      # Assert that it's not possible to match
  .*000   # any string that contains 000 from this point onwards.
 )        # End of lookahead assertion.
 \d+      # Match one or more digits.
)?        # End of the (optional) decimal part
$         # End of string.

In JavaScript:

curRegExp = /^(?:0|[1-9]\d*)(?:\.(?!.*000)\d+)?$/;

Regex: comma seperated indian currency format, Hi All, I'm new to WPF. I want to validate amount field in my project using regular expression. Here I want to allow user to enter only 1 decimal� Using javascript we can define regular expressions to validate input of an html entry box. The text entered into entry box must match with the format defined in regular expression. The built-in “test” function performs that matching. It the text is not matched, the check fails. In the following example, we match the currency with …

format number 1000000 to 12,34,567.00

<input id="item-purchase-amt" class="col-sm-12 form-control-plaintext tr-input" type="text" data-type="currency">

$(document).on('keyup', "input[data-type='currency']", function () {
$(document).on('blur', "input[data-type='currency']", function () {
formatCurrency($(this), "blur");

function currencyNumber(n) {
// format number 1000000 to 1,234,567
// return n.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")
// format number 1000000 to 12,34,567
return n.replace(/\D/g, "").replace(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g, "$1,");

function formatCurrency(input, blur) {
var input_val = input.val();
if (input_val === "") { return; }
var original_len = input_val.length;
var caret_pos = input.prop("selectionStart");
if (input_val.indexOf(".") >= 0) {
    var decimal_pos = input_val.indexOf(".");
    var left_side = input_val.substring(0, decimal_pos);
    var right_side = input_val.substring(decimal_pos);
    left_side = currencyNumber(left_side);
    right_side = currencyNumber(right_side);
    if (blur === "blur") {
        right_side += "00";
    right_side = right_side.substring(0, 2);
    input_val = left_side + "." + right_side;

} else {
    input_val = currencyNumber(input_val);
    input_val = input_val;
    if (blur === "blur") {
        input_val += ".00";
var updated_len = input_val.length;
caret_pos = updated_len - original_len + caret_pos;
input[0].setSelectionRange(caret_pos, caret_pos);

Validate Indian Currency using Regular Expression, Toggle navigation. RegEx Testing From Dan's Tools. Web Dev. HTML/JS/CSS Playground � HTML Color Codes � CSS Fonts � Online Diff Tool .htaccess� Here Mudassar Ahmed Khan has explained with an example, how to implement Indian PAN Card Number validation using Regular Expression (Regex) in JavaScript. The PAN Card Number entered in the TextBox will be validated on Button click using Regular Expression (Regex) in JavaScript. Download View Demo Download Free Files API

$(this).replace(/\B(?=(?:\d{3})+(?!\d))/g, ','); 
/*For US number system (millions & billions)*/

$(this).replace(/\B(?=(?:(\d\d)+(\d)(?!\d))+(?!\d))/g, ',');
/*For Indian number system (lakhs & crores)*/

These will format the value in the respective systems.

currency format with comma, A protip by bsimpson about ruby, regular expression, formatting, currency, and delimiters. In the US and many other countries, currency greater than or equal to 1000 units ($1,000.00) is typically broken up In Javascript:. This expression will validate for US Currency with a wide range of input. Using other exps found on this site, I built this one to fix 2 main problems I was finding: 1-a space or blank entry is non-matching 2-use of .9 in place of .90 will match (this is for those people like me who hate to type and if I put .9 I mean .90 Hope this helps others save a little time.

Indian Currency RegEx


US Currency RegEx


Formatting Currency via Regular Expression (Example), Formatting a number in JavaScript can be as simple as Basically the regex looks for a digit which is followed by digits (in groups of two)� How to validate pin code of India using Regular Expression Given a string of positive number ranging from 0 to 9 , the task is to check whether the number is valid pin code or not by using a Regular Expression .

Indian Currency Number Conversion RegExp

$(this).val(parseFloat($(this).val(), 10).toFixed(2).replace(/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g, "$1,").toString());

Foreign Currency Number Conversion RegExp

$(this).val(parseFloat($(this).val(), 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());

Format INR currency in JavaScript | by Vivek Kumar Bansal, regular expression currency with commas and decimal regex for currency symbol regular expression for indian currency format regex currency no dollar sign Regular expressions are a powerful tool. What impresses me about this pattern is that it is so terse, yet eliminates the need for more complex recursive function calls, or looping. The pattern here is defining insertion points for our delimiter while honoring all the rules of currency formatting.

Regular Expression to validate price, Regular Expression for Numeric value with multiple comma like currency in INR format. loading Rate this:� Validate an ip address Match an email address Url Validation Regex | Regular Expression - Taha Match or Validate phone number match whole word nginx test Match html tag Blocking site with unblocked games Find Substring within a string that begins and ends with paranthesis Empty String Checks the length of number and not starts with 0

Regular Expression for Numeric value with multiple comma like , This re matches US currency format with lead dollar sign. This provides a fix for the currency regular expression posted at For example this will work in .net but not javascript which doesn't support \p Also the ¢ is removed� How to validate currency in JavaScript? Validate Validate hi a beginner java and i need some help from u guys.. Its about validate.My HR request BF = 'brought forward', leave cannot apply date greater than 31/03 of particular year., Rs. 500.324 Rs 500.34 INR 34.34 RS 300.66 RS.35.6 ljasoihiasdjhcaslkcn kashkbdkjasbdkjasdb OTP is 76896 asjdjhasd Inr. 123,33ytyt.87676 alklsjjdhasd � JavaScript Form Validation: Removing Unwanted Parentheses. Unwanted parentheses surrounding area codes or telephone numbers, can be removed using regular expression and method replace() The regular expression searches for one or more parentheses, spaces or dashes , globally. Example: JavaScript Form Validation: Remove Unwanted Parentheses

  • why is 56.8906 valid when 10.000 is not?
  • if 56.8906 was in dollars, how can you give 56 dollars and '89.06' cents?
  • Not all the world is using dollars. This is Rupees.
  • having 3 consecutive zeroes is not a valid number. but 56.8906 is valid bcos the amount will be displayed only after doing some calculations...
  • i am now talking about indian rupees