String segmentMultiParam = "{segment0}asegment{segment1:^\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$}anotherseg";
segment = AbstractURLSegment.newSegment(segmentMultiParam);
assertTrue(segment instanceof MultiParamSegment);
MultiParamSegment multiParamSegment = (MultiParamSegment)segment;
List<AbstractURLSegment> subSegments = multiParamSegment.getSubSegments();
assertEquals(4, subSegments.size());
metaPattern = subSegments.get(2).getMetaPattern();
assertEquals(metaPattern.toString(), "^\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$");
segmentMultiParam = "filename-{symbolicName:[a-z]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}";
segment = AbstractURLSegment.newSegment(segmentMultiParam);
multiParamSegment = (MultiParamSegment)segment;
metaPattern = multiParamSegment.getMetaPatternWithGroups();
String fileName = "filename-gsaon-1.2.3.zip";
Matcher matcher = metaPattern.matcher(fileName);
assertTrue(matcher.matches());