I use javascript to test and find

"b123/c123".match(/([^/]+?)\/([^/]+?)/) = ["b123/c", "b123", "c"]
"b123/c123".match(/([^/]+?)\/([^/]+)/) = ["b123/c123", "b123", "c123"]
"b123/c123".match(/([^/]+)\/([^/]+)/) = ["b123/c123", "b123", "c123"]
"b123/c123".match(/([^/]+)\/([^/]+?)/) =["b123/c", "b123", "c"]

So the ? only have effects on the last path segment. But why the ? does not
have effects on the first path element?

Regards,
Rice

On Wed, Aug 4, 2010 at 11:38 AM, Rice Yeh <[email protected]> wrote:

> Hi,
>   In JAXRS spec, each uri template variable without regular expression
> specified is matched by regular expression  ([^/]+?). I do not understand
> the function of the ? mark in the group. Is it needed? That is, what is the
> difference b/w "([^/]+)" and "([^/]+?)" ?  Any regular expression guru can
> explain it?
>
> Regards,
> Rice
>

Reply via email to