P
Paul
Here is a pattern and the code snippet I have:
String pat = "#foo#([+-][0-9]+)*";
String input = "#foo#+1-2";
Pattern pattern = Pattern.compile(pat);
Matcher matcher = pattern.matcher(input);
while (matcher.find())
{
String matched = matcher.group(1);
...
}
The result I'm hoping for is to get "+1" and "-2" returned for
"matched" string. However, I'm only getting "-2" and then matcher is
done.
Can any shed some light on this?
Thanks,
Paul.
String pat = "#foo#([+-][0-9]+)*";
String input = "#foo#+1-2";
Pattern pattern = Pattern.compile(pat);
Matcher matcher = pattern.matcher(input);
while (matcher.find())
{
String matched = matcher.group(1);
...
}
The result I'm hoping for is to get "+1" and "-2" returned for
"matched" string. However, I'm only getting "-2" and then matcher is
done.
Can any shed some light on this?
Thanks,
Paul.