Filters the query string or fragment of a URI.

@param $str

@return string
357046
private function filterQueryAndFragment($str)
    {
        return preg_replace_callback(
            '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/',
            function ($match) { return rawurlencode($match[0]); },
            $str
        );
    }
828486
protected function modifyHost(string $str): string
    {
        return (string) $this->filterHost($str)->getContent(EncodingInterface::RFC3987_ENCODING);
    }
817048
protected function modifyHost(string $str): string
    {
        return (string) $this->filterHost($str)->replaceLabel($this->offset, $this->label);
    }
1021272
protected function modifyQuery(string $str): string
    {
        return (string) $this->filterQuery($str)->append($this->query);
    }
618893
protected function modifyHost(string $str): string
    {
        return (string) $this->filterHost($str, $this->resolver)->withSubDomain($this->label);
    }
263551
private function _filter_attributes(string $str): string
    {
        if ($str === '') {
            return '';
        }

        $out = '';
        if (\preg_match_all('#\s*[\\p{L}0-9_\-\[\]]+\s*=\s*("|\042|\'|\047)(?:[^\\1]*?)\\1#ui', $str, $matches)) {
            foreach ($matches[0] as $match) {
                $out .= $match;
            }
        }

        return $out;
    }
1292636
protected function extractReference(/*# string */ $str)/*# : array */
    {
        $res = [];
        if (preg_match_all(
            $this->getPattern(),
            $str,
            $matched,
            \PREG_SET_ORDER
        )) {
            foreach ($matched as $m) {
                $res[$m[1]] = $m[2];
            }
            return $res;
        }
        return $res;
    }
932937
public function string($str = null)
    {
        if ($str !== null) {
            foreach ($this->childScanners as $s) {
                $s->string($str);
            }
        }
        return parent::string($str);
    }
1202690
public static function unicodeUrldecode($str)
    {
       preg_match_all('/%u([[:alnum:]]{4})/', $str, $matches);

       foreach ($matches[1] as $uniord){
           $str = str_replace('%u'.$uniord, '&#x' . $uniord . ';', $str);
       }

       return urldecode($str);
    }
313908
protected function modifyHost(string $str): string
    {
        return (string) $this->filterHost($str)->prepend($this->label);
    }
1330998
private function filterQueryAndFragment($str)
    {
        if (!is_string($str)) {
            throw new \InvalidArgumentException('Query and fragment must be a string');
        }

        return preg_replace_callback(
            '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
            [$this, 'rawurlencodeMatchZero'],
            $str
        );
    }
1330790
public function parse( $str, $file_uri = null ){

		if( !$file_uri ){
			$uri_root = '';
			$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
		}else{
			$file_uri = self::WinPath($file_uri);
			$filename = $file_uri;
			$uri_root = dirname($file_uri);
		}

		$previousFileInfo = $this->env->currentFileInfo;
		$uri_root = self::WinPath($uri_root);
		$this->SetFileInfo($filename, $uri_root);

		$this->input = $str;
		$this->_parse();

		if( $previousFileInfo ){
			$this->env->currentFileInfo = $previousFileInfo;
		}

		return $this;
	}
1095932
protected function _a($str) {
		$self=$this;
		return preg_replace_callback(
			'/(?<!\\\\)\[(.+?)(?!\\\\)\]\h*\(<?(.*?)>?(?:\h*"(.*?)"\h*)?\)/',
			function($expr) use($self) {
				return '<a href="'.$self->esc($expr[2]).'"'.
					(empty($expr[3])?
						'':
						(' title="'.$self->esc($expr[3]).'"')).
					'>'.$self->scan($expr[1]).'</a>';
			},
			$str
		);
	}
1047660
public function filter_uri(&$str)
    {
        try {

            parent::filter_uri($str);

        } catch (Exception $e) {
            /**
             * If illegal characters are found, and in production halt with error. This
             * runs very early on so we can't use a 404 or similar. We don't want this
             * to bubble to error handlers as it'll just pollute the logs. On non-production
             * environments allow the exception to bubble so it's more obvious to the dev.
             *
             * This is obviously a fragile check :(
             */
            $sMessage = 'The URI you submitted has disallowed characters.';
            if (Environment::is(Environment::ENV_PROD) && $e->getMessage() === $sMessage) {
                ErrorHandler::halt($sMessage, '', HttpCodes::STATUS_NOT_FOUND);
            } else {
                throw $e;
            }
        }
    }
529243
public function find($str) {
        while ($line = $this->recvLine()) {
            if (preg_match("/{$str}/", $line, $matches)) {
                return $matches[0];
            }
        }
        return false;
    }
186785
public function clean_string($str)
    {
        if ($this->is_ascii($str) === FALSE) {
            if (MB_ENABLED) {
                $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
            } elseif (ICONV_ENABLED) {
                $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
            }
        }

        return $str;
    }
782214
function _filter_uri($str) {
		if ($str != '' && $this->permitted_uri_chars != '' && $this->enable_query_strings == FALSE) {
			// preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
			// compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
			if (!preg_match("|^[" . str_replace(array ('\\-','\-' ), '-', preg_quote($this->permitted_uri_chars, '-')) . "]+$|i", $str)) {
				show_error('The URI you submitted has disallowed characters.', 400);
			}
		}

		// Convert programatic characters to entities
		$bad=array ('$','(',')','%28','%29' );
		$good=array ('&#36;','&#40;','&#41;','&#40;','&#41;' );

		return str_replace($bad, $good, $str);
	}