If, by some accident, the number is not present, bradgrafelman will access an array element that does not exist. I would suggest a modification to either:
if (preg_match('/\[(\d+)\]/', $Text, $matches)) {
$Var = $matches[1];
// ...
} else {
// Report an error.
}
or:
$Var = preg_match('/\[(\d+)\]/', $Text, $matches) ? $matches[1] : 'some default value';
// ...