# get_shortcode_regex() only matches first shortcode

The Codex has an example of using get_shortcode_regex() to check if a shortcode is being called on a given page:

$pattern = get_shortcode_regex(); preg_match('/'.$pattern.'/s', $posts[0]->post_content,$matches);
if (is_array($matches) &&$matches[2] == 'YOURSHORTCODE') {
//shortcode is being used
}


This only detects the first shortcode in the post content, though. Is that a bug with get_shortcode_regex(), or can the preg_match() parameters be tweaks to make it return all shortcodes present on the page?