Indeed:

	public static void main (String[] args) throws java.lang.Exception
	{
		Pattern p = Pattern.compile("(?:([1-9]\\d*)\\.\\d+)|(?:0\\.(\\d+))");
		Matcher m = p.matcher("0.1");
		System.out.println(m.groupCount());
		System.out.println(m.group(1));
		System.out.println(m.group(2));
		m = p.matcher("1.0");
		System.out.println(m.groupCount());
		System.out.println(m.group(1));
		System.out.println(m.group(2));
	}
Output;
```
2
null
1
2
1
null
```
How about this and then `return Objects.firstNonNull(m.group(1), m.group(2));`? (from [Guava](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Objects.html#firstNonNull\(T, T\)))