Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Quote regular expression characters
<?php preg_quote(string $str, ?string $delimiter = null): string
<?php     public static function setTagsVariables(string $before, string $after): void {

        self::setTags([

            self::TAG_BEFORE => preg_quote($before),

            self::TAG_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function setTagsVariables(string $before, string $after): void {

        self::setTags([

            self::TAG_BEFORE => preg_quote($before),

            self::TAG_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function setTagsConditionals(string $before, string $after): void {

        self::setTags([

            self::TAG_CONDITIONAL_BEFORE => preg_quote($before),

            self::TAG_CONDITIONAL_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function setTagsConditionals(string $before, string $after): void {

        self::setTags([

            self::TAG_CONDITIONAL_BEFORE => preg_quote($before),

            self::TAG_CONDITIONAL_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function setTagsList(string $before, string $after): void {

        self::setTags([

            self::TAG_LIST_BEFORE => preg_quote($before),

            self::TAG_LIST_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function setTagsList(string $before, string $after): void {

        self::setTags([

            self::TAG_LIST_BEFORE => preg_quote($before),

            self::TAG_LIST_AFTER => preg_quote($after)

        ]);

    }
<?php     public static function pattern(): string {

        $tag_list_key = preg_quote(self::getTag(self::TAG_LIST_KEY));

        return self::buildPattern(self::TAG_BEFORE, '\s*' . $tag_list_key . '\s*', self::TAG_AFTER);

    }
<?php     public static function pattern(): string {

        $tag_chain = preg_quote(self::getTag(self::TAG_CHAIN));

        return self::buildPattern(self::TAG_LIST_BEFORE, '\s*(?P<x>[\w\W]+?' . $tag_chain . $tag_chain . '[\w\W]+?)\s*', self::TAG_LIST_AFTER);

    }
<?php     public static function pattern(): string {

        $tags = preg_quote(self::getTag(self::TAG_FILTER) . self::getTag(self::TAG_ARGUMENT) . self::getTag(self::TAG_CHAIN));

        return self::buildPattern(self::TAG_BEFORE, '\s*(?P<x>[\w,\-' . $tags . ']+?)\s*', self::TAG_AFTER);

    }
<?php     public function testConstruct() {

        $this->assertEquals('::', $this->phplater->getTag(PHPlater::TAG_ELSE));

        $this->assertEquals(preg_quote('(('), $this->phplater->getTag(PHPlater::TAG_CONDITIONAL_BEFORE));

        $this->assertEquals(preg_quote('[['), $this->phplater->getTag(PHPlater::TAG_LIST_BEFORE));

        $this->assertEquals(preg_quote('{{'), $this->phplater->getTag(PHPlater::TAG_BEFORE));

    }
<?php     public function testConstruct() {

        $this->assertEquals('::', $this->phplater->getTag(PHPlater::TAG_ELSE));

        $this->assertEquals(preg_quote('(('), $this->phplater->getTag(PHPlater::TAG_CONDITIONAL_BEFORE));

        $this->assertEquals(preg_quote('[['), $this->phplater->getTag(PHPlater::TAG_LIST_BEFORE));

        $this->assertEquals(preg_quote('{{'), $this->phplater->getTag(PHPlater::TAG_BEFORE));

    }
<?php         $this->assertEquals('::', $this->phplater->getTag(PHPlater::TAG_ELSE));

        $this->assertEquals(preg_quote('(('), $this->phplater->getTag(PHPlater::TAG_CONDITIONAL_BEFORE));

        $this->assertEquals(preg_quote('[['), $this->phplater->getTag(PHPlater::TAG_LIST_BEFORE));

        $this->assertEquals(preg_quote('{{'), $this->phplater->getTag(PHPlater::TAG_BEFORE));

    }
<?php     public function testTags() {

        $this->phplater->setPlate('string', 'ok');

        $this->phplater->setTagsVariables('<!--', '-->');

        $this->assertEquals(preg_quote('<!--'), $this->phplater->getTag(PHPlater::TAG_BEFORE));

        $this->assertEquals(preg_quote('-->'), $this->phplater->getTag(PHPlater::TAG_AFTER));

        $this->assertEquals('test ok', $this->phplater->render('test <!-- string -->'));

    }
<?php         $this->phplater->setPlate('string', 'ok');

        $this->phplater->setTagsVariables('<!--', '-->');

        $this->assertEquals(preg_quote('<!--'), $this->phplater->getTag(PHPlater::TAG_BEFORE));

        $this->assertEquals(preg_quote('-->'), $this->phplater->getTag(PHPlater::TAG_AFTER));

        $this->assertEquals('test ok', $this->phplater->render('test <!-- string -->'));

    }