split « matcher « Java Regex Q&A

Home
Java Regex Q&A
1.Development
2.find
3.group
4.Match
5.matcher
6.number
7.Operation
8.parse
9.Pattern
10.replace
11.validation
12.word
Java Regex Q&A » matcher » split 

1. Matcher returns matches on a regex pattern, but split() fails to find a match on the same regex?    stackoverflow.com

I can't see a reason why the Matcher would return a match on the pattern, but split will return a zero length array on the same regex pattern. It should return ...

2. Java Split not working as expected    stackoverflow.com

I am trying to use a simple split to break up the following string: 00-00000 My expression is: ^([0-9][0-9])(-)([0-9])([0-9])([0-9])([0-9])([0-9]) And my usage is:

String s = "00-00000";

String pattern = "^([0-9][0-9])(-)([0-9])([0-9])([0-9])([0-9])([0-9])";

String[] parts = s.split(pattern);
If I ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.