<?php

$re = '~(?:\G(?!^)\s+|\[shortcode\s+(\S+)\s+)([^\s=]+)="([^"]*)"~';
$str = '[shortcode contact param1="test 2" param2="test1"]';
$res = [];
if (preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0)) {
	foreach ($matches as $m) {
		array_shift($m);
		$res = array_merge($res, array_filter($m));
	}
}
print_r($res);
