I am trying to write a regex to get the numbers from strings like these ones:
javascript:ShowPage(\'6009\',null,null,null,null,null,null,null) javascript:Bloc
// PHP $string = 'ssss 12.2'; $pattern = '/\D*(\d+)(.|,)?(\d+)?\D*/'; $replacement = '$1.$3'; $res = (float)preg_replace($pattern, $replacement, $string); // output 12.2