The Java EE REST specifaction, JAX-RS, describes the translation of path variables to regexes, like in /customer/{id}.
From JAX-RS 1.1 Spec, page 19:
Replace each URI template variable with a capturing group containing the specified regular expression or ‘([ˆ/]+?)’ if no regular expression is specified.
The Java API doc of java.util.regex.Pattern says:
X? X, once or not at all
X+ X, one or more times
So, what means +??
the
?right after a+or a*means that it won’t be greedy.For example :
(.*)fin “testftestf”, the first group will match “testftest”(.*?)fin testftestf”, the first group will match “test”Resources :