fork download
  1. <?php
  2.  
  3. $text = "цена 200, цена 400, цена 600.";
  4. preg_match_all("/цена ([0-9]+)(?!.*цена [0-9]+)/", $text, $matches, PREG_PATTERN_ORDER);
  5. print_r($matches);
  6.  
  7. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => цена 600
        )

    [1] => Array
        (
            [0] => 600
        )

)