I'm not understanding why my regex pattern doesn't seem to work. Here is an example:
String token = "23030G40KT";
Pattern p = Pattern
.compile("(\\d{3}|VRB)|(\\d{2,3})|(G\\d{2,3})?|(KT|MPS|KMH)");
Matcher m = p.matcher(token);
while(m.find()){
System.out.println(m.group());
}
That prints out:
230
30
G40
(With two following blank lines that aren't showing here)
I'd like to print:
230
30
G40
KT
with no blank lines. What do I need to change?