Returns style rules for the given node id + class pattern.

@param string $pattern The node's pattern.

@return string[] The style rules to be applied.
199191
public function getContainerStyleByPattern($pattern)
    {
        if ($pattern === null) {
            return array();
        }

        $nodeStyles = array();
        if (!empty($this->parent)) {
            $nodeStyles = $this->parent->getContainerStyleByPattern($pattern);
        }

        $keys = $this->pregGrepStyle($pattern);
        foreach ($keys as $key) {
            $nodeStyles = array_merge($nodeStyles, $this->containerStyles[$key]);
        }

        return $nodeStyles;
    }
305544
public function list_tags($pattern = null) {
		$tagArray = explode("\n", $this->run("tag -l $pattern"));
		foreach ($tagArray as $i => &$tag) {
			$tag = trim($tag);
			if ($tag == '') {
				unset($tagArray[$i]);
			}
		}

		return $tagArray;
	}
1345872
private function getOptionByRegExpr(string $pattern): array
    {
        $purgedArgs = $this->getRawArgs(true);
        return preg_grep("/" . $pattern . "/", $purgedArgs);
    }
624482
private function matchPattern($pattern) {
        $regex = $this->patternToRegex($pattern);
        $result = preg_match($regex, $this->pathInfo);
        if ($result === false) {
            throw new Exception("拦截器匹配发生错误，错误的pathinfo模式：{$pattern}");
        }

        return $result == 1;
    }
372622
protected function collectPatterns(ClassNode $class)
    {
        $patterns = [];
        foreach ($this->patterns as [$srcPattern, $targetPattern, $message]) {
            if (preg_match($srcPattern, $class->getNamespaceName())) {
                $patterns[] = [$srcPattern, $targetPattern, $message];
            }
        }

        return $patterns;
    }
1255882
protected function parsePattern($pattern)
    {
        $currentPos      = 0;
        $length          = strlen($pattern);
        $tokens          = [];
        $level           = 0;
        $quotedDelimiter = preg_quote($this->delimiter);

        while ($currentPos < $length) {
            preg_match('(\G(?P<literal>[^:{\[\]]*)(?P<token>[:\[\]]|$))', $pattern, $matches, 0, $currentPos);

            $currentPos += strlen($matches[0]);

            if (!empty($matches['literal'])) {
                $tokens[] = ['literal', $matches['literal']];
            }

            if ($matches['token'] === ':') {
                if (!preg_match(
                    '(\G(?P<name>[^:' . $quotedDelimiter . '{\[\]]+)(?:{(?P<delimiters>[^}]+)})?:?)',
                    $pattern,
                    $matches,
                    0,
                    $currentPos
                )) {
                    throw new Exception\RuntimeException('Found empty parameter name');
                }

                $tokens[] = [
                    'parameter',
                    $matches['name'],
                    isset($matches['delimiters']) ? $matches['delimiters'] : null
                ];

                $currentPos += strlen($matches[0]);
            } elseif ($matches['token'] === '[') {
                $tokens[] = ['optional-start'];
                $level++;
            } elseif ($matches['token'] === ']') {
                $tokens[] = ['optional-end'];
                $level--;

                if ($level < 0) {
                    throw new Exception\RuntimeException('Found closing bracket without matching opening bracket');
                }
            } else {
                break;
            }
        }

        if ($level > 0) {
            throw new Exception\RuntimeException('Found unbalanced brackets');
        }

        return $tokens;
    }
747265
public function grep($pattern)
    {
        $results = array_intersect_key($this->attributes, array_flip(
            RegexGuard::getGuard()->grep($pattern, array_keys($this->attributes))
        ));

        return new static($results);
    }
809979
protected function getNestedPrefix($pattern)
    {
        $segments = explode("/", $pattern);
        $pattern = "";

        foreach ($segments as $index => $segment) {
            if (strpos($segment, "{") === 0) {
                   $pattern .= "/{" . $segments[$index - 1] . "_" . ltrim($segment, "{");
            } else $pattern .= $segment;
        }

        return $pattern;
    }
417707
public function getPattern()
    {
        if ($this->_pattern === null) {
            $this->_pattern = $this->extractTag('pattern');
        }

        return $this->_pattern;
    }
975012
static protected function analysisPattern($pattern)
    {
        if (!($n = self::$_mbstringAvailable ? mb_strlen($pattern, APP_CHARSET) : strlen($pattern))) {
            return [];
        }
        $ps = [];
        $c0 = self::$_mbstringAvailable ? mb_substr($pattern, 0, 1, APP_CHARSET) : substr($pattern, 0, 1);

        for ($start = 0, $i = 1; $i < $n; ++$i) {
            $c = self::$_mbstringAvailable ? mb_substr($pattern, $i, 1, APP_CHARSET) : substr($pattern, $i, 1);
            if ($c !== $c0) {
                $ps[] = self::$_mbstringAvailable ? mb_substr($pattern, $start, $i - $start, APP_CHARSET) : substr($pattern, $start, $i - $start);
                $c0 = $c;
                $start = $i;
            }
        }
        $ps[] = self::$_mbstringAvailable ? mb_substr($pattern, $start, $n - $start, APP_CHARSET) : substr($pattern, $start, $n - $start);
        return $ps;
    }
448069
protected function getServiceKeys($pattern = null)
    {
        $keys = $this->getKeys();
        $serviceKey = $this->getCacheKey();
        $serviceKeys = isset($keys[$serviceKey]) ? $keys[$serviceKey] : [];

        if (!is_null($pattern)) {
            $serviceKeys = $this->filterArrayValuesWithPattern(
                $serviceKeys,
                $pattern
            );
        }

        return $serviceKeys;
    }
418692
protected function _checkPcrePattern($pattern = null) {
		if (empty($pattern)) {
			return null;
		}

		$result = true;
		try {
			//@codingStandardsIgnoreStart
			$matchResult = @preg_match($pattern, 'some text');
			//@codingStandardsIgnoreEnd
			if ($matchResult === false) {
				$result = false;
			}
		} catch (Exception $exception) {
			$result = false;
		}

		return $result;
	}
1346290
public function glob($pattern)
    {
        $matched = [];
        $pattern = $this->realpath($pattern);
        $pattern = '@^' . str_replace(['\*', '\?'], ['[^\\\/]*', '.'], preg_quote($pattern)) .'$@';
        foreach (array_keys($this->files) as $path) {
            if (preg_match($pattern, $path))
                $matched[] = $path;
        }
        return $matched;
    }
820664
private function matchesPattern($pattern) {
        $regexEncoding = mb_regex_encoding();
        mb_regex_encoding($this->encoding);

        $match = mb_ereg_match($pattern, $this->str);
        mb_regex_encoding($regexEncoding);

        return $match;
    }
943207
public function transformPatternToRegex($pattern)
    {
        if (!isset($this->patternToRegexpCache[$pattern])) {
            $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
        }

        return $this->patternToRegexpCache[$pattern];
    }
40848
public static function extractHttpRoute($pattern)
    {
        $httpMethod = 'ALL';
        $routePattern = $pattern;
        if (false !== strpos($pattern, '#|#')) {
            list($httpMethod, $routePattern) = explode('#|#', $pattern, 2);
        }

        return array(strtoupper($httpMethod), $routePattern);
    }
868157
public function getTemplatesByPattern($pattern)
    {
        File::resolveFilepath($pattern);

        $templates = array();
        foreach ($this->_scriptdir as $dir) {
            if (true === is_array(glob($dir.DIRECTORY_SEPARATOR.$pattern))) {
                $templates = array_merge($templates, glob($dir.DIRECTORY_SEPARATOR.$pattern));
            }
        }

        return $templates;
    }