I need to create a regex in PHP that will identify the following tokens in a section of text:
[video:1]
[video:2]
The code I'm using is
preg_match("/\[video:[12]{1}\]/", $text, $matches);
with the idea that I can have one character of either 1 or 2 after '[video:' and then ']'. The problem I'm having is that it won't identify the second token if there are two of them in the text. It will identify either one if it is the first one, but not the second one if both are in the text.
How can I identify both tokens in my section of text?
Thanks.