<?php $strings = [ 'Rohlík 4,99 Kč 51235', 'Rohlík CZK 4,99 51235', 'Rohlík Kč4,99 51235', 'Rohlík foo4,99 51235' ]; foreach ($strings as $string) { var_export( preg_match('/\b(?:(?:Kč|CZK) ?\K\d+(?:,\d+)?|\d+(?:,\d+)?(?= ?(?:Kč|CZK)))\b/u', $string, $m) ? $m[0] : 'not found' ); echo "\n"; }
You have javascript disabled. You will not be able to edit any code.