Hello
I am learning regex and I have a question, which I have not understand the difference
0[xX]([0-9a-fA-F])
0[xX]([0-9a-fA-F]+)
Difference between those two ? Whenmy Matcher is
"Z0XFZQ0XFQZ0XA"
And
Pattern is
0[xX]([0-9a-fA-F])+
Complete Program is :
import java.util.regex.*;
class testing{
public static void main(
String args[]){
Pattern p = Pattern.compile("0[xX]([0-9a-fA-F])+");
Matcher m = p.matcher("Z0XFZQ0XFQZ0XA");
while(m.find()){
System.out.println(m.start());
}
}
}
The ouput is
1
6
11
I change the pattern to 0[xX]([0-9a-fA-F]) (No + sign)
now also the ouput is
1
6
11
CAN ANYBODY PL EXPLAIN WHAT FOR + sign in this case ? What different output I should get when I use + sign ? Thanks very much