Re: Extracting substring with regexp



On Jan 31, 4:09 pm, Eric Sosman <Eric.Sos...@xxxxxxx> wrote:
Eric:
Thanks a lot. You are right.
But here is mismatch in my knowledge again:
I assume that this


Pattern p = Pattern.compile("abc(.*)xyz");
Matcher m = p.matcher("xxxxxabc123xyz789xyzxxxxx");
if (m.find())System.out.println(m.group(1));

should print "123" but, instead, it prints "123xyz789".
How can I force regexp to find first match?

I agree that I should read the Sun documentation. And, trust me, I
did...

Thanks in advance.
Alex Kizub.
.