Please be more specific when posting. Like is this stuff between brackets a number? does it start at the beginning or the end.
Not knowing all that, I give you an example of an expression that retrieves a number between square brackets anywhere within a string:
$str = 'This is a test [123] with brackets';
if (preg_match('/.*?\[(\d*)\].*/', $str, $matches)) {
echo '<pre>', print_r($matches, TRUE), '</pre></br>';
$matches = $matches[1];
} else {
$matches = "";
}
echo $matches;
The above code would output something like this:
Array
(
[0] => This is a test [123] with brackets
[1] => 123
)
123
EDIT:
Posted too late.