I can see the below regular expression in the code ...
if (amount.matches("[-+]?[0-9]*\\.?[0-9]+")) return true;
now my query is that what this regular expression represent that amount should be numeric and what validation it will check
I can see the below regular expression in the code ...
if (amount.matches("[-+]?[0-9]*\\.?[0-9]+")) return true;
now my query is that what this regular expression represent that amount should be numeric and what validation it will check
Your regex works like this :
"[-+]?[0-9]*\\.?[0-9]+"
[-+]? --> either a `+` or `-` or nothing. Followed by
[0-9]* --> any number of digits (* implies greedy check). Followed by
`\\.?` --> 0 or 1 `.` (matched literally. ). Followed by
[0-9]+ --> one or more digits