| Author |
simple regex
|
ahmed yehia
Ranch Hand
Joined: Apr 22, 2006
Posts: 424
|
|
Hello I have the below code runs fine but I dont get the output. output: 0332 why would it print "2" at the end after group.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
Because you are using "*", which means zero or more times. So after finding "33", it also finds a non matching empty string, at index 2. It would work as expected if you'd use "+" instead.
|
[My Blog]
All roads lead to JavaRanch
|
 |
 |
|
|
subject: simple regex
|
|
|