code: public static function match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
      {
          $result = @preg_match(self::addUtf8Modifier($pattern), $subject, $matches, $flags, $offset);
          if (false !== $result && PREG_NO_ERROR === preg_last_error()) {
              return $result;
          }
  
          $result = @preg_match(self::removeUtf8Modifier($pattern), $subject, $matches, $flags, $offset);
          if (false !== $result && PREG_NO_ERROR === preg_last_error()) {
              return $result;
          }
  
          throw new PregException('Error occurred when calling preg_match.', preg_last_error());
      }
docs: @param string        $pattern
  @param string        $subject
  @param null|string[] $matches
  @param int           $flags
  @param int           $offset
  
  @throws PregException
  
  @return int