protected function _regex($regex, $param, $token, $prefix) {
		if ($regex) {
			$this->_subPatterns[$param] = $regex;
		} elseif ($param == 'args') {
			$regex = '.*';
		} else {
			$regex = '[^\/]+';
		}

		$req = $param === 'args' || array_key_exists($param, $this->_params) ? '?' : '';

		if ($prefix === '/') {
			$pattern = "(?:/(?P<{$param}>{$regex}){$req}){$req}";
		} elseif ($prefix === '.') {
			$pattern = "\\.(?P<{$param}>{$regex}){$req}";
		} else {
			$pattern = "(?P<{$param}>{$regex}){$req}";
		}
		return str_replace($token, $pattern, $this->_pattern);
	}
protected function _regex($regex, $param, $token, $prefix) {
		if ($regex) {
			$this->_subPatterns[$param] = $regex;
		} elseif ($param == 'args') {
			$regex = '.*';
		} else {
			$regex = '[^\/]+';
		}

		$req = $param === 'args' || array_key_exists($param, $this->_params) ? '?' : '';

		if ($prefix === '/') {
			$pattern = "(?:/(?P<{$param}>{$regex}){$req}){$req}";
		} elseif ($prefix === '.') {
			$pattern = "\\.(?P<{$param}>{$regex}){$req}";
		} else {
			$pattern = "(?P<{$param}>{$regex}){$req}";
		}
		return str_replace($token, $pattern, $this->_pattern);
	}
protected function _regex ( $ regex , $ param , $ token , $ prefix ) { if ( $ regex ) { $ this -> _subPatterns [ $ param ] = $ regex ; } elseif ( $ param == 'args' ) { $ regex = '.*' ; } else { $ regex = '[^\/]+' ; } $ req = $ param === 'args' || array_key_exists ( $ param , $ this -> _params ) ? '?' : '' ; if ( $ prefix === '/' ) { $ pattern = "(?:/(?P<{$param}>{$regex}){$req}){$req}" ; } elseif ( $ prefix === '.' ) { $ pattern = "\\.(?P<{$param}>{$regex}){$req}" ; } else { $ pattern = "(?P<{$param}>{$regex}){$req}" ; } return str_replace ( $ token , $ pattern , $ this -> _pattern ) ; }
Generates a sub-expression capture group for a route regex, using an optional user-supplied
matching pattern.

@param string $regex An optional user-supplied match pattern. If a route is defined like
`"/{:id:\d+}"`, then the value will be `"\d+"`.
@param string $param The parameter name which the capture group is assigned to, i.e.
`'controller'`, `'id'` or `'args'`.
@param string $token The full token representing a matched element in a route template, i.e.
`'/{:action}'`, `'/{:path:js|css}'`, or `'.{:type}'`.
@param string $prefix The prefix character that separates the parameter from the other
elements of the route. Usually `'.'` or `'/'`.
@return string Returns the full route template, with the value of `$token` replaced with a
generated regex capture group.
Generates a sub - expression capture group for a route regex using an optional user - supplied matching pattern .