I wouldn't use a regex for this, it's unnecessary.
Use strrpos and substr to extract the string that you need. It's simple, straightforward, and achieves the desired output.
It works by finding the last '(' in the string, and removing one character from the end of the string.
$str = "test 13 (8) end 12 (14:48 IN 1ST)";
echo substr( $str, strrpos( $str, '(') + 1, -1);
$str = "(dont want to capture the (8)) test 13 (8) end 12 (14:48 IN 1ST)";
echo substr( $str, strrpos( $str, '(') + 1, -1);
Demo
Edit: I should also note that my solution will work for all of the following cases:
- Empty parenthesis
- One set of parenthesis (i.e. the string before the desired grouping does not contain parenthesis)
- More than three sets of parenthesis (as long as the desired grouping is located at the end of the string)
- Any text following the last parenthesis grouping (per the edits below)
Final edit: Again, I cannot emphasis enough that using a regex for this is unnecessary. Here's an example showing that string manipulation is 3x - 7x faster than using a regex.
As per MetaEd's comments, my example / code can easily be modified to ignore text after the last parenthesis.
$str = "test 13 (8) end 12 (14:48 IN 1ST) fkjdsafjdsa";
$beginning = substr( $str, strrpos( $str, '(') + 1);
substr( $beginning, 0, strpos( $beginning, ')')) . "\n";
STILL faster than a regex.
{}are usually referred to as curly brackets (or braces).[]is brackets or square brackets, and what you have are parentheses.