Проверяет значение на соответствие регулярному выражению

@param string $pattern Регулярное выражение
@param string $comment Комментарий, отображаемый если Условие не выполнено

@return Validator
964286
public function matchRegex($pattern, $comment = "")
	{
		if ($this->isValid)
		{
			if (!preg_match($pattern, $this->val))
				self::addMessage($comment);
		}
		return $this;
	}
1374950
public function extractDoctrineTypeFromComment($comment, $currentType)
    {
        if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match)) {
            return $match[1];
        }

        return $currentType;
    }
103974
public function parse($comment)
    {
        $this->parser->setDocument($comment);

        $this->parsed = $this->parser->parse();


        return $this;
    }
351163
private function getRegexPatternFromHtmlErrorPattern($pattern)
    {
        $regexPattern = '';

        foreach ($pattern as $part) {
            if ($this->isTokenPatternPart($part)) {
                $regexPattern .= '.*';
            } else {
                $regexPattern .= PregQuoter::quote($part);
            }
        }

        return '/' . $regexPattern . '/is';
    }
414424
public function comment($comment = null) {
		if ($comment) {
			$this->_config['comment'] = $comment;
			return $this;
		}
		return $this->_config['comment'];
	}
1274071
public function vPhone(String $pattern = NULL)
    {
        return $this->setJavascriptValidation('ZNValidationPhone', 'phone', ['phone' => $pattern], [Base::presuffix($pattern, '\'')]);
    }
1118384
public function uncomment($comment = '#')
    {
        $commentLength = strlen($comment);
        foreach( $this->lines as &$line ) {
            if( 0 === strpos($line, $comment) ) {
                $line = substr( $line, $commentLength );
            }
        }
        return $this;
    }
1181151
public function fromComment($comment, $context = null)
    {
        if ($context === null) {
            $context = new Context(['comment' => $comment]);
        } else {
            $context->comment = $comment;
        }
        try {
            self::$context = $context;
            if ($context->is('annotations') === false) {
                $context->annotations = [];
            }
            $comment = preg_replace_callback(
                '/^[\t ]*\*[\t ]+/m',
                function ($match) {
                    // Replace leading tabs with spaces.
                    // Workaround for http://www.doctrine-project.org/jira/browse/DCOM-255
                    return str_replace("\t", ' ', $match[0]);
                },
                $comment
            );
            $annotations = $this->docParser->parse($comment, $context);
            self::$context = null;
            return $annotations;
        } catch (Exception $e) {
            self::$context = null;
            if (preg_match('/^(.+) at position ([0-9]+) in ' . preg_quote((string)$context, '/') . '\.$/', $e->getMessage(), $matches)) {
                $errorMessage = $matches[1];
                $errorPos = (int)$matches[2];
                $atPos = strpos($comment, '@');
                $context->line += substr_count($comment, "\n", 0, $atPos + $errorPos);
                $lines = explode("\n", substr($comment, $atPos, $errorPos));
                $context->character = strlen(array_pop($lines)) + 1; // position starts at 0 character starts at 1
                Logger::warning(new Exception($errorMessage . ' in ' . $context, $e->getCode(), $e));
            } else {
                Logger::warning($e);
            }
            return [];
        }
    }
718565
public function sendCommentSpamRequestMail( $comment, $updatePath ) {

		$siteName		= $this->coreProperties->getSiteName();
		$fromEmail		= $this->mailProperties->getSenderEmail();
		$fromName		= $this->mailProperties->getSenderName();
		$contactEmail	= $this->mailProperties->getContactEmail();

		// Send Mail
		$this->getMailer()->compose( self::MAIL_COMMENT_SPAM_REQUEST, [ 'coreProperties' => $this->coreProperties, 'comment' => $comment, 'updatePath' => $updatePath ] )
			->setTo( $contactEmail )
			->setFrom( [ $fromEmail => "$fromName | $siteName" ] )
			->setSubject( "Spam Request | " . $this->coreProperties->getSiteName() )
			//->setTextBody( "heroor" )
			->send();
	}
1255204
public function removeComment(Comment $comment)
    {
        if ($this->comments->contains($comment)) {
            $this->comments->removeElement($comment);
            $comment->setTask(null);
        }

        return $this;
    }
1268920
public function parseComment($needle_raw, $comment = null)
    {
        if ($comment === null) {
            $comment = $this->parameters->get('comment');
        }
        $needle_quoted = preg_quote($needle_raw);
        $pattern = sprintf('@\{(%1$s):%2$s\}(.+)\{\/(%1$s):%2$s\}@si', $this->getFormatter()->getCommentTagPrefix(), $needle_quoted);
        if (preg_match($pattern, $comment, $matches) && isset($matches[2])) {
            return $matches[2];
        }
    }
908805
public static function checkFilter($comment_string)
	{
		//define the regular expression pattern to use for string matching
		$pattern = "#(@[a-zA-Z]+\s*[a-zA-Z0-9, ()_].*)#";

		//perform the regular expression on the string provided
		preg_match_all($pattern, $comment_string, $matches, PREG_PATTERN_ORDER);

		//get the meta elements in array
		$meta_data_array = $matches[0];

		//check meta data was found
		if(count($meta_data_array) > 0){

			//set array for before and after filters
			$beforeFilters = array();
			$afterFilters = array();

			//loop through array getting before and after filters
			foreach($meta_data_array as $key => $value){

				//get before filter
				if(strpos($value, "@before") !== false){
					
					$strb = explode(' ', trim($value)); $strb = self::clean($strb);
					(isset($strb[1])) ? $beforeFilters[] = $strb[1] : ''; 
					(isset($strb[2])) ? $beforeFilters[] = $strb[2] : ''; 
					
				}

				//get after filters
				if(strpos($value,"@after") !== false){

					$stra = explode(' ', trim($value)); $stra = self::clean($stra);
					(isset($stra[1])) ? $afterFilters[] = $stra[1] : ''; 
					(isset($stra[2])) ? $afterFilters[] = $stra[2] : '';

				}

			}

			//define the array to return
			$return = array();

			//check if before and after filters were empty
			if( ! empty($beforeFilters)) $return['before'] = $beforeFilters;

			if( ! empty($afterFilters)) $return['after'] = $afterFilters;
				
			return $return;
		
		}

		//no meta data found, return false
		else return false;

	}
1074698
public function comment( $comment = '#' )
    {
        foreach( $this->lines as &$line ) {
            $line = $comment . $line;
        }
        return $this;
    }
127175
public function setComment($comment)
    {
        $returnValue = (bool) false;
        $this->removePropertyValues($this->getProperty(OntologyRdfs::RDFS_COMMENT));
        $this->setPropertyValue($this->getProperty(OntologyRdfs::RDFS_COMMENT), $comment);
        $this->comment = $comment;
        return (bool) $returnValue;
    }
1168601
private function validateRegex($pattern)
    {
        \set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
        try {
            \preg_match($pattern, '');
        } catch (ErrorException $e) {
            \restore_error_handler();
            throw new RuntimeException(\str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
        }
        \restore_error_handler();
    }
1243978
public static function alpha(Validator $validator, $data, $pattern, $rule)
    {
        foreach (Validator::getValues($data, $pattern) as $attribute => $value) {
            if (null === $value || empty($value)) {
                continue;
            }
            if (preg_match('/^([a-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖßÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ])+$/i', $value) === 1) {
                continue;
            }

            $validator->addError($attribute, $rule);
        }
    }
816207
public function isArray($comment = "")
	{
		if ($this->isValid)
		{
			if (!is_array($this->val))
				self::addMessage($comment);
		}

		return $this;
	}