Regular Expressions 101

Community Patterns

Matching decimals in european format (dot as grouping separator, comma as decimal separator)

2

Regular Expression
Java 8

"
^\d{1,3}(?:\.\d{3})*(?:,\d+)?$|^\d+(?:,)?\d+$
"
gm

Description

A regex for validating decimal numbers in the European number format (in many parts of Europe at least, including Germany). A comma is used as a separator for the decimal number, a dot as a separator for thousand places.

Submitted by Florian Drees - 3 years ago (Last modified 3 years ago)