protected function parseSegment($segment)
	{
		$optional = false;

		list($regex, $name) = \explode(":", $segment);

		if (\substr($name, -1) === "?")
		{
			$name = \substr($name, 0, -1);
			$optional = true;
		}

		if ($regex === "")
		{
			$regex = "[^\/]+";
		}

		$regex = "/(?P<{$name}>{$regex})";

		if ($optional)
		{
			$regex = "(?:{$regex})?";
		}

		return array(
			'segment' => $segment,
			'token' => "/".$segment,
			'name' => $name,
			'regex' => $regex,
			'optional' => $optional
		);
	}