$re = '/"(user|from)_id":(-?\d+)/';
$str = '{"response":{"count":21854,"items":[{"id":228162,"body":"๐","user_id":136649652,"from_id":331639485,"date":1484581971,"read_state":1,"out":1,"random_id":0,"emoji":1},{"id":228161,"body":"๐","user_id":136649652,"from_id":136649652,"date":1484581970,"read_state":1,"out":0,"emoji":1},{"id":228160,"body":"ัััะพัะบะต*","user_id":136649652,"from_id":136649652,"date":1484581969,"read_state":1,"out":0},{"id":228159,"body":"ะั","user_id":136649652,"from_id":331639485,"date":1484581969,"read_state":1,"out":1,"random_id":0},{"id":228158,"body":"๐","user_id":136649652,"from_id":136649652,"date":1484581962,"read_state":1,"out":0,"emoji":1},{"id":228157,"body":"ะธะปะธ","user_id":136649652,"from_id":136649652,"date":1484581962,"read_state":1,"out":0},{"id":228154,"body":"ัั ","user_id":136649652,"from_id":136649652,"date":1484581935,"read_state":1,"out":0}';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php