JavaScript regex to accept numbers with comma separator (thousands) and dot separator (decimals)

Jorge Oduber

Could any of you help me with a regular expression which will accept these:

For every thousand a comma will be accepted. No less than 4 decimal points in number

I've been testing this pattern but fails in some scenarios:

^\d+(\,\d+{1.3} \.d{1.4})*$

Valid inputs:

1
11
111
1,111
1,111,111
1.1111
11.1111
111.1111
1,111.1111

Invalid inputs:

Any letter
1,1
1.1
1.11
1,11.11
1,111.1

The main criterions are: (4 decimal points are obligatory). (3 numbers per thousand must have a comma.)

user663031

Is this more complicated than

/^\d\d?\d?(,\d\d\d)*(\.\d\d\d\d)?$/

or if you prefer

/^\d{1,3}(,\d{3})*(\.\d{4})?$/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to use jquery function on numbers separated by .(dot) or ,(comma) as thousands separator

From Dev

Python regex for number with or without decimals using a dot or comma as separator?

From Dev

NumericUpDown: accept both comma and dot as decimal separator

From Dev

NumericUpDown: accept both comma and dot as decimal separator

From Dev

Format number in R with both comma thousands separator and specified decimals

From Dev

Regex to extract numbers and group them with thousands separator

From Dev

Google form regex for numbers with comma as decimal separator

From Dev

How to accept both dot and comma as a decimal separator with WTForms?

From Dev

How to calculate numbers with dot thousand separator in javascript

From Dev

Parsing numbers with a comma decimal separator in JavaScript

From Dev

Sort numbers with thousands separator and strings

From Dev

Format numbers with apostrophe as thousands separator

From Dev

dot instead of comma as thousand separator

From Dev

How to convert floating point decimal separator from dot to comma in Javascript

From Dev

Format a decimal with comma as decimal separator and without thousands separator

From Dev

Regex for positive lookahead thousand separator that would not mach numbers after dot

From Dev

include comma separator in javascript for loop

From Dev

regex for multiple formats decimals and thousand separator

From Dev

Regex valid numbers with thousand separator

From Dev

Regex valid numbers with thousand separator

From Dev

Decimal dot and thousands separator used both in input type number

From Dev

Add comma separator to a numbers with 2 decimal points

From Dev

php - add comma thousands separator but remove trailing zeros

From Dev

HTML5 Input Pattern to allow comma separator for thousands

From Dev

pandas reading CSV data formatted with comma for thousands separator

From Dev

php - add comma thousands separator but remove trailing zeros

From Dev

Regex for formatting comma for decimal places and dot for thousands

From Dev

Parsing decimal with thousands separator

From Dev

Counter with thousands separator

Related Related

  1. 1

    How to use jquery function on numbers separated by .(dot) or ,(comma) as thousands separator

  2. 2

    Python regex for number with or without decimals using a dot or comma as separator?

  3. 3

    NumericUpDown: accept both comma and dot as decimal separator

  4. 4

    NumericUpDown: accept both comma and dot as decimal separator

  5. 5

    Format number in R with both comma thousands separator and specified decimals

  6. 6

    Regex to extract numbers and group them with thousands separator

  7. 7

    Google form regex for numbers with comma as decimal separator

  8. 8

    How to accept both dot and comma as a decimal separator with WTForms?

  9. 9

    How to calculate numbers with dot thousand separator in javascript

  10. 10

    Parsing numbers with a comma decimal separator in JavaScript

  11. 11

    Sort numbers with thousands separator and strings

  12. 12

    Format numbers with apostrophe as thousands separator

  13. 13

    dot instead of comma as thousand separator

  14. 14

    How to convert floating point decimal separator from dot to comma in Javascript

  15. 15

    Format a decimal with comma as decimal separator and without thousands separator

  16. 16

    Regex for positive lookahead thousand separator that would not mach numbers after dot

  17. 17

    include comma separator in javascript for loop

  18. 18

    regex for multiple formats decimals and thousand separator

  19. 19

    Regex valid numbers with thousand separator

  20. 20

    Regex valid numbers with thousand separator

  21. 21

    Decimal dot and thousands separator used both in input type number

  22. 22

    Add comma separator to a numbers with 2 decimal points

  23. 23

    php - add comma thousands separator but remove trailing zeros

  24. 24

    HTML5 Input Pattern to allow comma separator for thousands

  25. 25

    pandas reading CSV data formatted with comma for thousands separator

  26. 26

    php - add comma thousands separator but remove trailing zeros

  27. 27

    Regex for formatting comma for decimal places and dot for thousands

  28. 28

    Parsing decimal with thousands separator

  29. 29

    Counter with thousands separator

HotTag

Archive