fork download
  1. <?php
  2. $string ="i have 300 $, 1000$ ,500 euro in my account";
  3. $regex = '~\d+(?:\s?(?:\$|euro))~';
  4. preg_match_all($regex, $string, $matches);
  5. print_r($matches);
  6. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => 300 $
            [1] => 1000$
            [2] => 500 euro
        )

)