Matcher m = SEGMENT_PATTERN.matcher(str);
PathSegment r = null;
PathSegment previous = null;
PathSegment current;
while (m.find()) {
CollisionBehavior col = (m.start(GROUP_COLLISION) != -1) ? CollisionBehavior.find(m.group(GROUP_COLLISION))
: CollisionBehavior.DEFAULT;
if (m.start(GROUP_INDEX) != -1) {
String d = m.group(GROUP_INDEX);
current = new PathSegment.ArraySegment(Integer.parseInt(d), col);