C
Calum MacLean
I have the following code:
Pattern pattern = Pattern.compile("1.*3");
Matcher matcher = pattern.matcher("1234567890123");
matcher.find();
System.out.println(matcher.start() + " --> " + matcher.end());
I would expect this to match just the first 3 characters. Instead, it
matches all the characters. The following is the output:
0 --> 13
Is there any way I could get it to match just the 3 characters? Or
does regex not work this way?
Thanks,
Calum
Pattern pattern = Pattern.compile("1.*3");
Matcher matcher = pattern.matcher("1234567890123");
matcher.find();
System.out.println(matcher.start() + " --> " + matcher.end());
I would expect this to match just the first 3 characters. Instead, it
matches all the characters. The following is the output:
0 --> 13
Is there any way I could get it to match just the 3 characters? Or
does regex not work this way?
Thanks,
Calum