I have a numberDecimal EditText which I want to validate using a regular expression. In validation what I want is:
Before the decimal point, th
You could try something like this: ^[1-9][0-9]{0,2}(\\.\\d)?$. This should match any number which does not start with 0 (^[1-9]) and is followed by at most two numbers ([0-9]{0,2}). The regex also allows for an optional decimal value ((\\.\\d)?$).
That being said, ideally you should parse the string value to a double or float and make what ever validations you need to make using the actual numerical value.
To parse your string into a double value, you will need to use the Double.parseDouble(String s) like so: double myValue = Double.parseDouble(EditText.getText());