I can use a little help with this regex. The regex below works.
$regexgameid = '/{gameid\s([0-9][0-9][0-9][0-9][0-9])|([0-9][0-9][0-9][0-9][0-9])|([0-9][0-9][0-9][0-9][0-9])}/i';
preg_match_all($regexgameid, $articletext, $matchesgameid, PREG_SET_ORDER);
Example targeted shortcode: {gameid 45735 76352 87262}
The game id's count could be one or three.
With my logic it would be this:
$regexgameid = '/{gameid\s([0-9]{5}){1,3}}/i';
preg_match_all($regexgameid, $articletext, $matchesgameid, PREG_SET_ORDER);
But this regex above doesn't work.
What I'm trying to achieve is to get the results from preg_match_all() in an array structure like this:
Array
(
[0] => {gameid
[1] => 45735
[2] => 76352
[3] => 87262
[4] => }
)
so that I can replace the whole {gameid 45735 76352 87262} shortcode in the article text with information about the 3 game ids.