Question: I have :

```
^-?[0-9]\d*(\.\d+)?$

```

But need it to allow only up to 3 decimal places. So allowed values are:

```
+10.123

-10.123

10.123

10

+10

-10

10.1

10.12

```

Not allowed:

```
10.1234

10.123%

```

Advice / suggested expression mods appreciated.

Thanks in advance.

Answer: 
`^[+-]{0,1}\d*?(\.{0,1}\d{0,3})?$` should work

see <https://regex101.com/r/P6DBrW/1/> for Explanation of the regexp
```
^(?!0\d)\d*         
(\.\d{1,4})?$ 

```