3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '1.20099'; //$string = 'we 100,200,300,400,500,600,700,800,900 wf '; //$string = 'we 100,200,300,400,500,600,700,800,900.9 wf '; //$string = 'we +1200300400500600700800900.99 wf '; //$string = 'we +1200300400500600700800900.99 wf'; //preg_match_all('/([+-])?[\d.,]+([.,]\d{1,2})?/', $string, $matches); //preg_match_all("/[+-]?\d{1,3}[.,]+(\d{3}[.,'])(?R)?/", $string, $matches); //preg_match_all("/[+-]?\d{1,3}[., ]?(?:\d{3}[., ]?)(?R)?/", $string, $matches); //preg_match_all("/\d{1,3}(?:[,]?\d{3})(?R)?/", $string, $matches); //preg_match_all('/[+-]?\d{1,3}(?:,?\d{3})*(?:\.\d{2})?/', $string, $matches); preg_match_all('/^\d{1,3}(?:[,. ]?\d{3})*(?:([.,])\d{1,2})?($|\D)/', $string, $matches); print_r($matches);
based on idC8X
Output for 4.3.0 - 7.2.0
Array ( [0] => Array ( [0] => 1. ) [1] => Array ( [0] => ) [2] => Array ( [0] => . ) )