Question: From the [`Pattern`](http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html) javadocs:

```

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

```

The description of what they do is the same...so, what is the difference?

I would really appreciate some examples.

*I am coding in Java, but I hear this concept is the same for most modern regex implementations.*

Answer: 
A greedy operator always try to "grab" as much of the input as possible, while a reluctant quantifier will match as little of the input as possible and still create a match.

Example:

```
"The red fox jumped over the red fence"
/(.*)red/ => \1 = "The red fox jumped over the "
/(.*?)red/ => \1 = "The "

"aaa"
/a?a*/ => \1 = "a", \2 = "aa"
/a??a*/ => \1 = "", \2 = "aaa"

"Mr. Doe, John"
/^(?:Mrs?.)?.*\b(.*)$/ => \1 = "John"
/^(?:Mrs?.)?.*?\b(.*)$/ => \1 = "Doe, John"

```
say you have a regex `"a\w*b"`, and use it on `"abab"`
Greedy matching will match `"abab"` (it looks for an `a`, as much occurrences of `\w` as possible, and a `b`) and reluctant matching will match just `"ab"` (as little `\w` as possible)