<?php include __DIR__ . '/../vendor/autoload.php'; $template = new \RegTemplate\RegTemplate(); $template->parse_template(' There {{ is_are|reg="(?:is|are)" }} {{ number|digits }} instance{{ plural|reg="s?" }} of this. '); $matches = $template->match(' There is 1 instance of this. '); var_dump($matches); $matches = $template->match(' There are 10 instances of this. '); var_dump($matches); $matches = $template->match_all(' There is 1 instance of this. There are 20 instances of this. There are 30 instances of this. '); var_dump($matches);
<?php include __DIR__ . '/../vendor/autoload.php'; $template = new \RegTemplate\RegTemplate(); $template->parse_template(' Card {{ card_name }}: {{ cpu|float }}% '); $matches = $template->match_all(' --- CPU Table --- Card 1-1: 45.6% Card 1-2: 43.6% Card 2-1: 13.56% Card 2-2: 99.0% '); var_dump($matches);