Sekhar Nat

Greenhorn
+ Follow
since Jun 11, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sekhar Nat

@Darryl. Yes you are right. Pipe character isn't necessary. Thanks
8 years ago
I think it is not necessary. [+-] should do good. Take a look at this.
8 years ago
Thanks Stephen. This works now.


@Campbell. Thanks. Just looked at how scanner.nextDouble() works.
8 years ago


Quoting the docs:

ListIterator<E> listIterator()
Returns a list iterator over the elements in this list (in proper sequence).
ListIterator<E> listIterator(int index)
Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
8 years ago
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
8 years ago