Question: I wanted to create a pattern for my `matches` in groovy. The input should range from `0 to 100`, but accepts `decimal value`. I know that this is possible by using the `double` datatype, but as a requirement I need to set the datatype of this property as a `String` that's why I need to set up the correct pattern of the matches for the `String` for it to work properly. Possible input:

```
1) 1 - valid
2) 1.5301 - valid
3) 99.6732 - valid
4) 99.1 - valid
5) 100.1 - invalid
6) 100 - valid

```

Thank you so much!

Answer: 
This should work:

```
100(\.0+)?|([1-9]?[0-9])(\.[0-9]+)?

```
You can (and should) use a range of doubles:

```
groovy:000> ((0.0d)..(100.0d)).containsWithinBounds(100.1d)
===> false
groovy:000> ((0.0d)..(100.0d)).containsWithinBounds(99.6732d)
===> true

```

And getting a double from string:

```
groovy:000> ((0.0d)..(100.0d)).containsWithinBounds("99.6732" as double)
===> true
groovy:000> ((0.0d)..(100.0d)).containsWithinBounds("100.01" as double) 
===> false

```