Regex for decimal number with range


#1

Hi,

I need a regex allowing input for a number from 1.0 to 7.0

My try (not working):

(([1-7]|1[07])(\.\d{1}))$

#2

Disclaimer: I have little knowledge of RegEx Expressions

Try this:

(([1-7]|.[0-9])(.\d{1}))$

Test here:
https://regex101.com


#3

The answer is:

^(?:7(?:\.0)?|[1-6](?:\.[0-9])?|0?\.[1-9])$

#4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.