I'm trying to come up with a regex pattern that will work with regexp_like in Impala and which will match values that are decimals (up to ten numbers followed by a decimal followed by one or more numbers).
I have a pattern which is working in .NET ("^-?\d{1,10}\.\d+$"
), but this isn't working in regexp_like.
I've tried something similar in Impala ("^-?[0-9]{1,10}\.[0-9]+$"
), but it keeps returning true for integers. Why isn't it requiring the decimal to be there?
Some expected scenario results:
0 = False
0. = False
.5 = False
0.1 = True
123456 = False
-123456 = False
123456.2 = True
-123456.2 = True
Test = False
I'd like to make it even more complex and disallow numbers that start with multiple zeros, but I can't even get it to require the decimal point.