Registers a matching pattern for URI parameters.

@param string $name
Name which will appear within curly-braces in URI patterns.
@param string $regexp
Regexp substitution pattern.
184404
public function addPattern(string $name, string $regexp)
    {
        $this->regexp_map = ['/\{(\w+):'.$name.'\}/' => '(?<$1>'.$regexp.')'] + $this->regexp_map;
    }
431121
public static function register($name, $path, $controller, $methods=null, $restrictTo=null, $defaultResponse, $options=array()) {
		if( $methods && !is_array($methods) ) {
			$methods = array($methods);
		}
		foreach( static::$knownMethods as $method ) {
			if( (!$methods && !empty(static::$routes[$name][$method])) || ($methods && !in_array($method, $methods)) ) {
				continue;
			}
			static::$routes[$name][$method] = new static($name, $path, $controller, $method, $restrictTo, $defaultResponse, $options);
		}
	}
1269020
public function addMethod($name, $method) 
	{
		$this->methods[$name] = array(
			'name' => $name,
			'call' => $method
		);
		xmlrpc_server_register_method( $this->xmlrpc, $name, array( $this, 'call' ) );
	}
1357393
public function getRegexp($nameRegex, $valueRegex = null)
    {
        $this->arguments[] = '--get-regexp';
        $this->addNameAndPattern($nameRegex, $valueRegex);
        return $this;
    }
721958
function(name) {
    var regexp, idx,
      length = this.extraHeaders.length;

    if (this.headers[Utils.headerize(name)]) {
      return true;
    } else {
      regexp = new RegExp('^\\s*'+ name +'\\s*:','i');
      for (idx=0; idx<length; idx++) {
        if (regexp.test(this.extraHeaders[idx])) {
          return true;
        }
      }
    }

    return false;
  }
1204099
public function parse($regExp)
    {
        if (!$regExp) {
            throw new \InvalidArgumentException('RegExp is empty');
        }

        $startDelimiter = $regExp[0];
        $delimiterPairs = RegExp::getDelimiterPairs();
        $endDelimiter = isset($delimiterPairs[$startDelimiter])
            ? $delimiterPairs[$startDelimiter]
            : $startDelimiter;
        $endDelimiterPosition = strrpos($regExp, $endDelimiter);
        if (!$endDelimiterPosition) {
            throw new \InvalidArgumentException(sprintf('Closing delimiter %s not found', $startDelimiter));
        }

        return new RegExp(
            $startDelimiter,
            $endDelimiter,
            substr($regExp, 1, $endDelimiterPosition - 1),
            substr($regExp, $endDelimiterPosition + 1)
        );
    }
599080
public function when($pattern, $name, $methods = null)
	{
		if ( ! is_null($methods)) $methods = array_map('strtoupper', (array) $methods);

		$this->patternFilters[$pattern][] = compact('name', 'methods');
	}
53058
public function check($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (strlen($matches[0]) &&
                mb_strpos($this->getRemainder(), $matches[0]) === 0) {
                return $this->setState($matches);
            }
        }
        return $this->setState();
    }
1308479
public function scan($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (strlen($matches[0]) &&
                mb_strpos($this->getRemainder(), $matches[0]) === 0) {
                return $this->setState($matches,
                    $this->head + mb_strlen($matches[0]), $this->head);
            }
        }
        return $this->setState();
    }
97862
protected function getAttributeNamesFromRegexps(array $regexps)
	{
		$attrNames = [];
		foreach ($regexps as list($regexp, $map))
		{
			$attrNames += array_flip(array_filter($map));
		}

		return $attrNames;
	}
23003
public static function set($name, $uri = null, $regex = null, $force = false)
    {
        Base::getLog()->debug(__METHOD__ . ' call static get method', [
            'name'  => $name,
            'uri'   => $uri,
            'regex' => $regex,
            'force' => $force,
        ]);
        if (isset(self::$routeInstances[$name]) && ! $force)
        {
            return self::$routeInstances[$name];
        }
        return self::$routeInstances[$name] = new Entry([
            'uri'      => $uri,
            'regex'    => $regex,
            'identify' => $name,
        ]);
    }
1245961
public static function replace($name, $uri = null, $regex = null)
    {
        Base::getLog()->debug(__METHOD__ . ' call static replace method', [
            'name'  => $name,
            'uri'   => $uri,
            'regex' => $regex,
        ]);
        return self::set($name, $uri, $regex, true);
    }
188131
public static function registerPartial($name, $partial)
    {
        Argument::i()
            //Argument 1 must be a string
            ->test(1, 'string')
            //Argument 2 must be a string
            ->test(2, 'string');

        self::$partials[$name] = $partial;
    }
1104302
protected function _setRegexps($regexps)
    {
        if (!is_array($regexps)) {
            Zend_Cache::throwException('regexps option must be an array !');
        }
        foreach ($regexps as $regexp=>$conf) {
            if (!is_array($conf)) {
                Zend_Cache::throwException('regexps option must be an array of arrays !');
            }
            $validKeys = array_keys($this->_specificOptions['default_options']);
            foreach ($conf as $key=>$value) {
                if (!is_string($key)) {
                    Zend_Cache::throwException("unknown option [$key] !");
                }
                $key = strtolower($key);
                if (!in_array($key, $validKeys)) {
                    unset($regexps[$regexp][$key]);
                }
            }
        }
        $this->setOption('regexps', $regexps);
    }
8854
function makeFilenameRegex(name) {
  if (!_.isString(name)) {
    throw new TypeError('name parameter must be of type "String"');
  }

  const regexString = `^${name}(?:[.](.+))?.(${fileExtensions.join('|')})$`;
  return new RegExp(regexString);
}
678247
public static function reg($name,$bind,$option='GET')
    {
        if(!is_object(self::$ds)){
            self::$ds=new Register();
        }
        $domain='';
        if(is_array($option)){
            $domain=isset($option['domain']) ? $option['domain'] : '';
            $method=isset($option['method']) ? $option['method'] : 'GET';
        }else{
            $method=$option;
        }
        return self::$ds->add($name,$bind,$method,$domain);
    }
509220
public function safe($name = null, $ext = null)
    {
        if (!$name) {
            $name = $this->name;
        }
        if (!$ext) {
            $ext = $this->ext();
        }

        return preg_replace("/(?:[^\w\.-]+)/", '_', static::_basename($name, $ext));
    }