Hi!
The reason is that * and ? also match zero times. So in your example 1, the regEx already matches the first k, which is followed by zero as. Even if a longer sequence comes later on in the string.
If there is a match, the regEx tries to be as greedy as possible, that's why you get kkka in example 2.
HTH, Rata
In reply to Re: basic question: regular expression
by Ratazong
in thread basic question: regular expression
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |