I have to implement almost similar system to Spring PathVariable. I know how to parse my own url definition:
Definition :
blog-{String}-{Integer}
Code :
Pattern p = Pattern.compile("\\{.+?\\}");
Matcher m = p.matcher(pathFormat);
while(m.find())
{
String group = m.group();
// ...
}
But how can I parse real urls with my format? If real url was like
blog-my-first-blogging-10001
Real url doesn't have brackets, so how can I use regex to match my groups. Type of group is known, but how to match without brackets ?