Parses url code.
<code>
[url="http://example"]my link[/url]
</code>
@param string $text Text
@return string
@uses $pattern
506923
public function url($text)
    {
        return preg_replace_callback($this->pattern['url'], function ($matches) {
            return $this->Html->link($matches[2], $matches[1]);
        }, $text);
    }
436504
public static function parse($text) {
    static $int_regex = <<<'EOF'
/^[+-]?(?:
  0
  | [1-9][0-9]*
  | 0[xX][0-9a-fA-F]+
  | 0[0-7]+
  | 0b[01]+
)$/x
EOF;
    static $decimal_regex = <<<EOF
/^[+-]?(?:
  [0-9]*\.[0-9]+ (?:[eE][+-]?[0-9]+)?
  | [0-9]+\.[0-9]* (?:[eE][+-]?[0-9]+)?
  | [0-9]+[eE][+-]?[0-9]+
)$/x
EOF;
    static $var_regex = '/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/';
    switch ($text) {
      case 'abstract':
        return static::_abstract();
      case 'array':
        return static::_array();
      case 'as':
        return static::_as();
      case 'break':
        return static::_break();
      case 'callable':
        return static::_callable();
      case 'case':
        return static::_case();
      case 'catch':
        return static::_catch();
      case 'class':
        return static::_class();
      case 'clone':
        return static::_clone();
      case 'const':
        return static::_const();
      case 'continue':
        return static::_continue();
      case 'declare':
        return static::_declare();
      case 'default':
        return static::_default();
      case 'die':
        return static::_die();
      case 'do':
        return static::_do();
      case 'echo':
        return static::_echo();
      case 'else':
        return static::_else();
      case 'elseif':
        return static::_elseIf();
      case 'empty':
        return static::_empty();
      case 'enddeclare':
        return static::_endDeclare();
      case 'endfor':
        return static::_endFor();
      case 'endforeach':
        return static::_endForeach();
      case 'endif':
        return static::_endIf();
      case 'endswitch':
        return static::_endSwitch();
      case 'endwhile':
        return static::_endWhile();
      case 'eval':
        return static::_eval();
      case 'exit':
        return static::_exit();
      case 'extends':
        return static::_extends();
      case 'final':
        return static::_final();
      case 'finally':
        return static::_finally();
      case 'for':
        return static::_for();
      case 'foreach':
        return static::_foreach();
      case 'function':
        return static::_function();
      case 'global':
        return static::_global();
      case 'goto':
        return static::_goto();
      case 'if':
        return static::_if();
      case 'implements':
        return static::_implements();
      case 'include':
        return static::_include();
      case 'include_once':
        return static::_includeOnce();
      case 'instanceof':
        return static::_instanceOf();
      case 'insteadof':
        return static::_insteadOf();
      case 'interface':
        return static::_interface();
      case 'isset':
        return static::_isset();
      case 'list':
        return static::_list();
      case 'namespace':
        return static::_namespace();
      case 'new':
        return static::_new();
      case 'print':
        return static::_print();
      case 'private':
        return static::_private();
      case 'protected':
        return static::_protected();
      case 'public':
        return static::_public();
      case 'require':
        return static::_require();
      case 'require_once':
        return static::_requireOnce();
      case 'return':
        return static::_return();
      case 'static':
        return static::_static();
      case 'switch':
        return static::_switch();
      case 'throw':
        return static::_throw();
      case 'trait':
        return static::_trait();
      case 'try':
        return static::_try();
      case 'unset':
        return static::_unset();
      case 'use':
        return static::_use();
      case 'var':
        return static::_var();
      case 'while':
        return static::_while();
      case 'yield':
        return static::_yield();
      case 'and':
        return static::logicalAnd();
      case 'or':
        return static::logicalOr();
      case 'xor':
        return static::logicalXor();
      case '(array)':
        return static::arrayCast();
      case '(bool)':
      case '(boolean)':
        return static::booleanCast();
      case '(real)':
      case '(double)':
      case '(float)':
        return static::doubleCast();
      case '(int)':
      case '(integer)':
        return static::integerCast();
      case '(object)':
        return static::objectCast();
      case '(string)':
        return static::stringCast();
      case '(unset)':
        return static::unsetCast();
      case '__halt_compiler':
        return static::haltCompiler();
      case '__CLASS__':
        return static::classConstant();
      case '__DIR__':
        return static::dirConstant();
      case '__FILE__':
        return static::fileConstant();
      case '__FUNCTION__':
        return static::functionConstant();
      case '__LINE__':
        return static::lineConstant();
      case '__METHOD__':
        return static::methodConstant();
      case '__NAMESPACE__':
        return static::namespaceConstant();
      case '__TRAIT__':
        return static::traitConstant();
      case '...':
        return static::splat();
      case '=>':
        return static::doubleArrow();
      case '->':
        return static::objectOperator();
      case '::':
        return static::doubleColon();
      case '&=':
        return static::bitwiseAndAssign();
      case '|=':
        return static::bitwiseOrAssign();
      case '^=':
        return static::bitwiseXorAssign();
      case '*=':
        return static::multiplyAssign();
      case '/=':
        return static::divideAssign();
      case '%=':
        return static::modulusAssign();
      case '+=':
        return static::addAssign();
      case '-=':
        return static::subtractAssign();
      case '.=':
        return static::concatAssign();
      case '===':
        return static::isIdentical();
      case '==':
        return static::isEqual();
      case '!==':
        return static::isNotIdentical();
      case '!=':
        return static::isNotEqual();
      case '<=':
        return static::isLessThanOrEqual();
      case '>=':
        return static::isGreaterThanOrEqual();
      case '&&':
        return static::booleanAnd();
      case '||':
        return static::booleanOr();
      case '<<':
        return static::bitwiseShiftLeft();
      case '<<=':
        return static::bitwiseShiftLeftAssign();
      case '>>':
        return static::bitwiseShiftRight();
      case '>>=':
        return static::bitwiseShiftRightAssign();
      case '\\':
        return static::namespaceSeparator();
      case '--':
        return static::decrement();
      case '++':
        return static::increment();
      case '`':
      case '~':
      case '!':
      case '@':
      case '%':
      case '^':
      case '&':
      case '*':
      case '(':
      case ')':
      case '-':
      case '+':
      case '=':
      case '{':
      case '}':
      case '[':
      case ']':
      case '|':
      case ':':
      case ';':
      case "'":
      case '"':
      case '<':
      case ',':
      case '>':
      case '.':
      case '?':
      case '/':
        return new TokenNode($text, $text);
      case ' ':
        return static::space();
      case '?>':
        return static::closeTag();
      default:
        if (rtrim($text) === '<?php') {
          return static::openTag();
        }
        elseif (preg_match($int_regex, $text)) {
          return static::integer($text);
        }
        elseif (preg_match($decimal_regex, $text)) {
          return static::decimalNumber($text);
        }
        elseif (preg_match($var_regex, $text)) {
          return static::variable($text);
        }
        // @todo handle all tokens as per http://php.net/manual/en/tokens.php
        throw new \InvalidArgumentException("Unable to parse '{$text}'");
    }
  }
254056
static public function parseText($text)
    {
        $text = (string)$text;
        // links
        $text = preg_replace('@(https?://([-\w\.]+)+(/([\w/_\.]*(\?\S+)?(#\S+)?)?)?)@', '<a href="$1">$1</a>', $text);
        // users         
        $text = preg_replace('(@([a-zA-Z0-9_]+))', '<a href="http://www.twitter.com/\1">\0</a>', $text);
        // hastag
        $text = preg_replace(
            '/(^|\s)#(\w*[a-zA-Z_]+\w*)/',
            '\1<a href="http://search.twitter.com/search?q=%23\2">#\2</a>',
            $text
        );

        return $text;
    }
651046
public static function urlize($text, $separator = '-')
    {
        $text = self::unaccent($text);

        return self::postProcessText($text, $separator);
    }
515011
protected function processInline($text)
    {
        while ($text) {
            if (preg_match(self::MATCH_LINK, $text, $m)) {
                return $this->processLink($m[1], $m[2], $m[3], $m[4]);
            }

            $importantTextAhead = $this->lookAhead($text, self::STRONG_START_END);
            $emphasizedTextAhead = $this->lookAhead($text, self::EMPHASIZED_START_END);

            if ($importantTextAhead === false) {
                $importantTextAhead = $this->lookAhead($text, self::STRONG_START_END_TYPE_2);
            }

            if ($emphasizedTextAhead === false) {
                $emphasizedTextAhead = $this->lookAhead($text, self::EMPHASIZED_START_END_TYPE_2);
            }

            if ($importantTextAhead !== false && $emphasizedTextAhead !== false) {
                if ($importantTextAhead <= $emphasizedTextAhead) {
                    $unformattedText = mb_substr($text, 0, $importantTextAhead);
                    $importantText = mb_substr($text, $importantTextAhead);
                    $this->text($unformattedText);

                    return $this->processStrong($importantText);
                } else {
                    $unformattedText = mb_substr($text, 0, $emphasizedTextAhead);
                    $emphasizedText = mb_substr($text, $emphasizedTextAhead);
                    $this->text($unformattedText);

                    return $this->processEmphasized($emphasizedText);
                }
            } elseif ($importantTextAhead !== false) {
                $unformattedText = mb_substr($text, 0, $importantTextAhead);
                $importantText = mb_substr($text, $importantTextAhead);
                $this->text($unformattedText);

                return $this->processStrong($importantText);
            } elseif ($emphasizedTextAhead !== false) {
                $unformattedText = mb_substr($text, 0, $emphasizedTextAhead);
                $emphasizedText = mb_substr($text, $emphasizedTextAhead);
                $this->text($unformattedText);

                return $this->processEmphasized($emphasizedText);
            }

            $text = $this->processRestOfLine($text);
        };

        return ''; //All text is consumed
    }
677497
public function parse(string $text)
    {
        try {
            $result = $this->syntax->parse($text);
            $this->success = true;
        } catch (ParseException $e) {
            $result = $this->default;
            $this->success = false;
        }

        return $result;
    }
789583
public function parse($text) {
      $this->queue = array();
      $this->parser = xml_parser_create();        
      $this->parsed = 0;     
      $this->opened = 0;
      xml_set_object($this->parser, $this);
      xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
      xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
      $code = xml_parse_into_struct($this->parser, $text, $vals, $index); 
      /**
       * Parse into bAML
       * type structure
       * 
       */ 
      if ($code != 0) {
        return XMLUtility::Make($this, $vals); 
      }
        
      throw new \CatapultApiException("Provided text was not valid XMLUtility..");
    }
755989
public function parse($text) {
        parent::parse($text);

        $number = self::executeStep1($this->text, $this->barcodeIdentifier, $this->serviceTypeIdentifier, $this->mailerIdentifier, $this->serialNumber);
        $crc = self::executeStep2($number);
        $codewords = self::executeStep3($number);
        $codewords = self::executeStep4($codewords, $crc);
        $characters = self::executeStep5($codewords, $crc);
        $this->data = self::executeStep6($characters);
    }
994358
private function parseContent($text) {
        /* $yAlreadySet has 3 states: */
        /* null: There is no variable in the ID; true: the variable is already set; false: the variable is not set yet; */
        $content = null;
        $yAlreadySet = null;
        $realNameId = null;
        $separatorsFound = 0;
        $checksumAdded = 0;
        $decimalPointRemoved = 0;
        $toParse = str_replace('~F1', chr(29), $text);
        $nbCharToParse = strlen($toParse);
        $nbCharId = 0;
        $isFormated = $toParse[0] === '(' ? true : false;
        $maxCharId = $isFormated ? self::MAX_ID_FORMATED : self::MAX_ID_NOT_FORMATED;
        $id = strtolower(substr($toParse, 0, min($maxCharId, $nbCharToParse)));
        $id = $isFormated ? $this->findIdFormated($id, $yAlreadySet, $realNameId) : $this->findIdNotFormated($id, $yAlreadySet, $realNameId);

        if ($id === false) {
            if ($this->allowsUnknownIdentifier === false) {
                return false;
            }

            $id = null;
            $nbCharId = 0;
            $content = $toParse;
        } else {
            $nbCharId = strlen($id) + ($isFormated ? 2 : 0);
            $n = min($this->identifiersAi[$realNameId][self::MAXLENGTH], $nbCharToParse);
            $content = substr($toParse, $nbCharId, $n);
        }

        if ($id !== null) {
            /* If we have an AI with an "y" var, we check if there is a decimal point in the next *MAXLENGTH* characters */
            /* if there is one, we take an extra character */
            if ($yAlreadySet !== null) {
                if (strpos($content, '.') !== false || strpos($content, ',') !== false) {
                    $n++;
                    if ($n <= $nbCharToParse) {
                        /* We take an extra char */
                        $content = substr($toParse, $nbCharId, $n);
                    }
                }
            }
        }

        /* We check for separator */
        $separator = strpos($content, chr(29));
        if ($separator !== false) {
            $content = substr($content, 0, $separator);
            $separatorsFound++;
        }

        if ($id !== null) {
            /* We check the conformity */
            if (!$this->checkConformity($content, $id, $realNameId)) {
                return false;
            }

            /* We check the checksum */
            if (!$this->checkChecksum($content, $id, $realNameId, $checksumAdded)) {
                return false;
            }

            /* We check the vars */
            if (!$this->checkVars($content, $id, $yAlreadySet, $decimalPointRemoved)) {
                return false;
            }
        }

        $this->identifiersId[] = $id;
        $this->identifiersContent[] = $content;

        $nbCharLastContent = (((strlen($content) + $nbCharId) - $checksumAdded) + $decimalPointRemoved) + $separatorsFound;
        if ($nbCharToParse - $nbCharLastContent > 0) {
            /* If there is more than one content in this array, we parse again */
            $otherContent = substr($toParse, $nbCharLastContent, $nbCharToParse);
            $nbCharOtherContent = strlen($otherContent);

            if ($otherContent[0] === chr(29)) {
                $otherContent = substr($otherContent, 1);
                $nbCharOtherContent--;
            }

            if ($nbCharOtherContent > 0) {
                $text = $otherContent;
                return $this->parseContent($text);
            }
        }

        return true;
    }
977451
public function parse($text)
    {
        $names = $this->names
            ? implode('|', array_map('preg_quote', $this->names))
            : RegexBuilderUtility::buildNameRegex();
        $regex = str_replace('<NAMES>', $names, static::$shortcodeRegex);
        preg_match_all($regex, $text, $matches, PREG_OFFSET_CAPTURE);

        $shortcodes = array();
        $count = count($matches[0]);
        for($i = 0; $i < $count; $i++) {
            $name = $matches[2][$i][0];
            $parameters = static::parseParameters($matches[3][$i][0]);
            $content = $matches[5][$i][1] !== -1 ? $matches[5][$i][0] : null;
            $match = $matches[0][$i][0];
            $offset = mb_strlen(substr($text, 0, $matches[0][$i][1]), 'utf-8');

            $shortcode = new Shortcode($name, $parameters, $content, null);
            $shortcodes[] = new ParsedShortcode($shortcode, $match, $offset);
        }

        return $shortcodes;
    }
1046790
protected function getEscapedPattern($text)
    {
        $rawPattern = preg_quote($text, '/');

        $escapedPattern = preg_quote(e($text), '/');

        return $rawPattern == $escapedPattern
            ? $rawPattern : "({$rawPattern}|{$escapedPattern})";
    }
1177539
protected function parseAttributes($text)
    {
        // decode attribute values
        $text = htmlspecialchars_decode($text, ENT_QUOTES);

        $attributes = [];
        // attributes pattern
        $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
        // Match
        if (preg_match_all($pattern, preg_replace('/[\x{00a0}\x{200b}]+/u', " ", $text), $match, PREG_SET_ORDER)) {
            foreach ($match as $m) {
                if (!empty($m[1])) {
                    $attributes[strtolower($m[1])] = stripcslashes($m[2]);
                } elseif (!empty($m[3])) {
                    $attributes[strtolower($m[3])] = stripcslashes($m[4]);
                } elseif (!empty($m[5])) {
                    $attributes[strtolower($m[5])] = stripcslashes($m[6]);
                } elseif (isset($m[7]) && strlen($m[7])) {
                    $attributes[] = stripcslashes($m[7]);
                } elseif (isset($m[8])) {
                    $attributes[] = stripcslashes($m[8]);
                }
            }
        } else {
            $attributes = ltrim($text);
        }

        // return attributes
        return is_array($attributes) ? $attributes : [$attributes];
    }
517727
public function parse(string $text)
    {
        if (! is_numeric($text))
            throw new ParseException($this, $text, 0, self::ERROR);
        return $text + 0;
    }
368499
public function parse($text) {
        $this->setStartFromText($text);

        $this->text = '';
        $seq = '';

        $currentMode = $this->starting_text;

        // Here, we format correctly what the user gives.
        if (!is_array($text)) {
            $seq = $this->getSequence($text, $currentMode);
            $this->text = $text;
        } else {
            // This loop checks for UnknownText AND raises an exception if a character is not allowed in a table
            reset($text);
            while (list($key1, $val1) = each($text)) {     // We take each value
                if (!is_array($val1)) {                    // This is not a table
                    if (is_string($val1)) {                // If it's a string, parse as unknown
                        $seq .= $this->getSequence($val1, $currentMode);
                        $this->text .= $val1;
                    } else {
                        // it's the case of "array(ENCODING, 'text')"
                        // We got ENCODING in $val1, calling 'each' again will get 'text' in $val2
                        list($key2, $val2) = each($text);
                        $seq .= $this->{'setParse' . $this->METHOD[$val1]}($val2, $currentMode);
                        $this->text .= $val2;
                    }
                } else {                        // The method is specified
                    // $val1[0] = ENCODING
                    // $val1[1] = 'text'
                    $value = isset($val1[1]) ? $val1[1] : '';    // If data available
                    $seq .= $this->{'setParse' . $this->METHOD[$val1[0]]}($value, $currentMode);
                    $this->text .= $value;
                }
            }
        }

        if ($seq !== '') {
            $bitstream = $this->createBinaryStream($this->text, $seq);
            $this->setData($bitstream);
        }

        $this->addDefaultLabel();
    }
153037
public static function find(string $text) : Header
    {
        $matches = [];
        $parent = new Header();
        if (\preg_match_all(self::HEADERS_REGEX, $text, $matches, PREG_OFFSET_CAPTURE)) {
            foreach ($matches[0] as $index => $match) {
                $parent->append(new Header((int)$match[1], \strlen($match[0]), (int)$matches[1][$index][0], $matches[2][$index][0]));
            }
        }
        return $parent;
    }
731136
public function link(string $url, string $text)
    {
        return $this->add(Link::to($url, $text));
    }
1064254
public function getParsedText(string $text): string
    {
        $parser = new Node_Container_Document(true, false);

        if ($this->configData['emoticons']['active']) {
            $parser->add_emoticons($this->configData['emoticons']['path']);
        }

        $result = $parser->parse($text)
            ->detect_links()
            ->detect_emails();

        if ($this->configData['emoticons']['active']) {
            $result->detect_emoticons();
        }

        return $result->get_html();
    }