I've writing a regex for validating decimal values.
These are the conditionals:
Decimal values can have a + or -
The value can have either a dot or a comma as the decimal separator
The maximum number of digits before the decimal separator is 8
The maximum number of digits after the decimal separator is 3
This is the regex i've written but it somehow doesn't seem to work..I'm writing this inside a Inputfilter in android and matcher.matches() returns true for 999999999 etc.
Pattern mPattern = Pattern.compile("[\\+\\-]?[0-9]{0,8}[,|.]?[0-9]{0,3}");
What is the problem with this regex?
Thank you