<?php $case = '2 s foo'; function test($case) { $reg1 = <<<'REGEX' /(?(DEFINE) (?<int> (?:\G|(?!\n)) \s*\b \d{1,5} \s* ) (?<timepart> ( s | m | h | d ) \b ) ) ^((?&int)) ((?&timepart))(?<string>.+)$ /uix REGEX; $out = preg_replace_callback ($reg1, function($matches){ var_dump($matches); }, $case); } $output = test($case); var_dump($output);
You have javascript disabled. You will not be able to edit any code.