<?php function dumpMatches(string $regex, string $value): void { echo $regex . "\n"; if (preg_match($regex, $value, $matches) !== 1) { echo "no match\n"; } else { var_dump($matches); } echo "\n"; } dumpMatches('~a\Kb~', 'ab'); dumpMatches('~a\Kb~', 'b'); dumpMatches('~(a)\Kb~', 'ab'); dumpMatches('~(a\K)b~', 'ab');
You have javascript disabled. You will not be able to edit any code.