In my case should look like the regular season?

Tell me how should look a regex.

There is a line
10 000 RUB
12 000 RUB


preg_replace('/[^\d]/', ", $string);

The crux of the matter is that I need to get the number only from the first row, the second just not be ignored. But for sure if there's a line break so can't get the line at the time of parsing.
June 8th 19 at 17:08
2 answers
June 8th 19 at 17:10
Solution
preg_replace('/^([\s\d]+).*/is', '$1', $str);
then you can still remove the spaces
preg_replace('/\s+/', ", $str);
June 8th 19 at 17:12
preg_replace('/^(\d+)\s(\d+).*/s', '$1$2', $str);

Find more questions by tags PHP