Search code examples
regexnumber-formattinggoogle-forms

Google form regex for numbers with comma as decimal separator


I'm trying to figure out a regex to be used in Google Forms data validation for numbers with comma as a decimal separator.

Examples of valid entries:

123,5 ; 1 ; 0,1 ; 0,001

Examples of invalid entries:

123.5 ; [a-z] ; any characters other than numbers

I've already tried ^[1-9]\d*(,\d+)?$ but it doesn't seem to accept commas.


Solution

  • Example:
    123,5 ; 1 ; 0,1 ; 0,001

    RegExp

    [\d*.\,{1}\;{1}]
    

    Try it: http://regexr.com/3f0r0