This does the job:
$string = 'This the s number [:[123084]:] and [:[123085]:] 12374[:[123087]:]';
preg_match_all('/(?<=\[:\[)\d+(?=\]:\])/', $string, $matches);
print_r($matches);
Output:
Array
(
[0] => Array
(
[0] => 123084
[1] => 123085
[2] => 123087
)
)
Explanation:
/ : regex delimiter
(?<= : lookbehind, zero length assertion, make sure we have the following BEFORE the current position
\[:\[ : literally [:[
) : end lookbehind
\d+ : 1 or more digits
(?= : lookahead, zero length assertion, make sure we have the following AFTER the current position
\]:\] : literally ]:]
) : end lookahead
/ : regex delimiter
You will find usefull informations here