Question: I am modifying a regex validator control. 
The regex at the moment looks like this:

```
(\d*\,?\d{2}?){1}$

```

As I can understand it allows for a number with 2 decimal places. 

I need to modify it like this:

* The number must range from 0 - 1.000.000. (Zero to one million).
* The number may or may not have 2 decimals.
* The value can not be negative.
* Comma (`,`) is the decimal separator.
* Should not allow any thousand separators.

Answer: 
Try this regex:

```
^(((0|[1-9]\d{0,5})(\,\d{2})?)|(1000000(\,00)?))$

```

It accepts numbers like: `"4", "4,23", "123456", "1000000", "1000000,00"`, 
but don't accepts: `",23", "4,7", "1000001", "4,234", "1000000,55"`. 

If you want accept only numbers with exactly two decimals, use this regex:

```
^(((0|[1-9]\d{0,5})\,\d{2})|(1000000\,00))$

```
```
^(([0-9]|([1-9][0-9]{1,5}))(\.[0-9]{1,2})?)|1000000$

```