Return current keys in use

@param string|null $pattern
@return string[]
186354
public function getKeys($pattern = null)
    {
        $keys = $this->get('__stored_keys__', []);
        if (is_null($pattern)) {
            return $keys;
        }

        $matches = [];
        $pattern = $this->_normalizePattern($pattern);
        foreach ($keys as $key) {
            if (preg_match($pattern, $key)) {
                $matches[] = $key;
            }
        }

        return $matches;
    }
601816
function list_keys($pattern = '')
    {
        $this->load_pgp_driver();
        $result = $this->pgp_driver->list_keys($pattern);

        if ($result instanceof enigma_error) {
            self::raise_error($result, __LINE__);
        }

        return $result;
    }
1262761
public function findRecursive($pattern = '.*', $sort = false)
    {
        if (!$this->pwd()) {
            return [];
        }
        $startsOn = $this->path;
        $out = $this->_findRecursive($pattern, $sort);
        $this->cd($startsOn);

        return $out;
    }
854356
public function pregMap( string$pattern, callable$callback ):array
	{
		preg_match_all($pattern,ltrim($this->content,"\t"),$matches);
		return array_map($callback,...$matches);
	}
1236795
public function getNestedFileCount( $pattern = NULL )
	{
		$count	= 0;
		foreach( $this->getNestedFileList( $pattern ) as $entry )
			$count++;
		return $count;
	}
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;
	}
822371
protected function parsePattern($pattern)
    {
        $parts = [
            'min' => '[0-5]?\d',
            'hour' => '[01]?\d|2[0-3]',
            'day' => '0?[1-9]|[12]\d|3[01]',
            'month' => '[1-9]|1[012]',
            'dow' => '[0-7]',
            'year' => '20([0-9]{2})',
        ];

        $regex = [];
        foreach (array_slice($parts, 0, 5) as $name => $number) {
            $range = '('.$number.')(-('.$number.'))?';
            $regex[$name] = '(?P<'.$name.'>(\*(\/\d+)?|'.$range.'(,'.$range.')*))';
        }
        $range = '('.$parts['year'].')(-('.$parts['year'].'))?';
        $regexYear = '( (?P<year>(\*(\/\d+)?|'.$range.'(,'.$range.')*)))?';

        $regex = '/^'.implode('([\s\t]+)', $regex).$regexYear.'$/';
        preg_match($regex, $pattern, $matches);

        return array_intersect_key($matches, $parts);
    }
247432
public Set<byte[]> keys(String pattern){
		Set<byte[]> keys = null;
		Jedis jedis = jedisPool.getResource();
		try{
			keys = jedis.keys(pattern.getBytes());
		}finally{
			jedisPool.returnResource(jedis);
		}
		return keys;
	}
477494
public function getPrerequisites(string $pattern = ViewInterface::pattern): array {
		
		// by default, the $pattern for this method matches the one
		// for the applyTemplate() method above, and both match the
		// public constant from the ViewInterface.  you can change the
		// pattern, but they'd better be the same, or you'll get funky
		// results.
		
		preg_match_all($pattern, $this->content, $matches);
		
		// the $matches array should have two indices.  the first is the
		// actual matched text which, by default, includes the dollar sign
		// that identifies template variables.  but, the second index is
		// the parenthetical match, which is the word following the dollar
		// sign.  so, all we want to do is send back that array but without
		// any duplicates as follows.
		
		return array_unique($matches[1]);
	}
1110368
protected function get_sequence( $pattern ) {
		$characters = Strings::mb_str_split( str_replace( '.', '_', $pattern ) );
		$result     = [];

		foreach ( $characters as $index => $chr ) {
			if ( ctype_digit( $chr ) ) {
				$result[] = $chr;
			} else {
				// Append '0' if this is the first character or the previous character was not a number.
				if ( ! isset( $characters[ $index - 1 ] ) || ! ctype_digit( $characters[ $index - 1 ] ) ) {
					$result[] = '0';
				}

				// Append '0' if this is the last character.
				if ( ! isset( $characters[ $index + 1 ] ) ) {
					$result[] = '0';
				}
			}
		}

		// Do some error checking.
		$count     = count( $result );
		$count_seg = mb_strlen( $this->get_segment( $pattern ) );
		$sequence  = implode( '', $result );

		if ( $count !== $count_seg + 1 ) {
			throw new \RangeException( "Invalid segment length $count for pattern $pattern (result sequence $sequence)." );
		}

		return $sequence;
	}
716084
public function pubSubChannels($pattern = null) {
        $payload = ['pubsub', 'channels'];

        if ($pattern !== null) {
            $payload[] = $pattern;
        }

        return $this->send($payload);
    }
238144
public function filterChangedProperties(string $pattern) : array
    {
        return array_filter($this->changedProperties, function ($key) use ($pattern) {
            return preg_match($pattern, $key) > 0;
        }, ARRAY_FILTER_USE_KEY);
    }
1282365
public static function searchMediaTypes(string $pattern):array
    {
        $pattern = strtolower($pattern);
        $results = [];
        foreach (self::getMediaTypes() as $extension => $mediaType) {
            if (fnmatch($pattern, $mediaType)) {
                $results[$extension] = $mediaType;
            }
        }
        return $results;
    }
53034
public function getPattern($key = null)
    {
        return isset($this->patterns[$key]) ? $this->patterns[$key] : $this->patterns;
    }
739209
public static List<String> getCamelKeys(String pattern) {
        List<String> keys = new ArrayList<String>();
        for (String s : getOriginalKeys(pattern)) {
            keys.add(StringUtil.underlineToCamel(s));
        }
        return keys;
    }
524127
public function unsubscribe(...$pattern)
    {
        list($command, $channel, $subscribedChannels) = $this->__call('unsubscribe', $pattern);
        $this->subscribed = $subscribedChannels > 0;

        return [$command, $channel, $subscribedChannels];
    }
414735
private function getMatchStringParameterIndices($matchString, $pattern)
    {
        $indices = [];

        foreach ($pattern as $part) {
            if (!$this->isTokenPatternPart($part)) {
                $offset = 0;

                foreach ($indices as $currentIndex) {
                    $prefix = $currentIndex['prefix'];

                    if ($prefix == $part || substr_count($prefix, $part) || substr_count($part, $prefix)) {
                        $offset = $currentIndex['index'];
                    }
                }

                $indices[] = [
                    'prefix' => $part,
                    'index' => strpos($matchString, $part, $offset) + strlen($part)
                ];
            }
        }

        return $indices;
    }