I am learning how the greedy quantifiers work, but I am not getting the result I am expecting from the code below, with this argument given (Notice I am using *, dot and + quantifiers)
I like to know why the result comes as 0 "CooLooLCuuL"
in both of those arguments instead of:
0 CooL 6 LC 10 CooL
public class TestClass
public static void main(String args)
Pattern p = Pattern.compile(args);
Matcher m = p.matcher(args);
boolean b = false;
while(b = m.find())
System.out.print(m.start()+" \""+m.group()+"\" ");
Open in new window
I will appreciate your response.
and * says match many of them
so it matches the whole string