Repeated floating number from 0 to 1
9 replies
0(\.\d+)?|1\.0
Explanation:
0 # a zero
(\.\d+)? # a dot and min 1 numeric digit - this is made optional by ?
| # or
1\.0 # one, a dot and a zero
If you need this to match the entire sring, you need the carriage and dollar signs that represent the start of the line and the end of the line, respectively, as in ^(0(\.\d+)?|1\.0)$
Also, if you want to find possible negative numbers, you will need to add an optional minus sign, as in ^-?(0(\.\d+)?|1\.0)$
. For exhibitors, of course, you need to change the template.
+5
source to share