Greedy quantifiers
X? X, once or not at all
X* X, zero or more times
X+ X, one or more times
X{n} X, exactly n times
X{n,} X, at least n times
X{n,m} X, at least n but not more than m times
Reluctant quantifiers
X?? X, once or not at all
X*? X, zero or more times
X+? X, one or more times
X{n}? X, exactly n times
X{n,}? X, at least n times
X{n,m}? X, at least n but not more than m times
Possessive quantifiers
X?+ X, once or not at all
X*+ X, zero or more times
X++ X, one or more times
X{n}+ X, exactly n times
X{n,}+ X, at least n times
X{n,m}+ X, at least n but not more than m times
cn any one expalin me wht is the difference between the above three.
If some one can provide examples it would be great help
thnx in advance
Roedy Green - 07 Mar 2006 07:43 GMT
>cn any one expalin me wht is the difference between the above three.
see http://mindprod.com/jgloss/regex.html
Sometime words fail. You need to write yourself a little test program
and feed it strings and see what it does.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
manzur - 07 Mar 2006 07:57 GMT
wht actually i want to know was :
In Greedy quantifiers the api says
X? X, once or not at all
In Reluctant quantifiers the api says
X?? X, once or not at all
I was not able to understand wht X means in the above two scenarious.
Jussi Piitulainen - 07 Mar 2006 08:23 GMT
> wht actually i want to know was :
> In Greedy quantifiers the api says
[quoted text clipped - 5 lines]
>
> I was not able to understand wht X means in the above two scenarious.
It stands for a regular expression. You can instantiate those
documentation lines with any old expression you want, as long as its
bound tight enough with respect to the quantifier.
[^_^]? matches [^_^] once or not at all
(<maybe>)? matches <maybe> once or not at all
X? stands for both of these, and many more.
<maybe>? matches <maybe and then > once or not at all
Here X? stands for >?.
hiwa - 07 Mar 2006 09:00 GMT
Good read for regex novice:
http://java.sun.com/docs/books/tutorial/extra/regex/index.html
Differences Among Greedy, Reluctant, and Possessive Quantifiers
http://java.sun.com/docs/books/tutorial/extra/regex/quant.html
Roedy Green - 07 Mar 2006 17:05 GMT
>I was not able to understand wht X means in the above two scenarious.
Did you read the link I gave you?
Did you do write an experimenting regex class?

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.