$tagContentEndPosition = strpos($this->_text, ']', $tagStartPosition);
//Modification starts
$bbCodesOptionsPattern = '#\[(?:/)?[\w\d]+?(?:=(\[([\w\d]+?)(?:=.+?)?\].+?\[/\2\]|[^\[\]])+?)?(?P<closingBracket>\])#iu';
if(preg_match($bbCodesOptionsPattern, $this->_text, $matches, PREG_OFFSET_CAPTURE, $tagStartPosition) && isset($matches['closingBracket'][1]))
{
$tagContentEndPosition = $matches['closingBracket'][1];
}
else
{
$tagContentEndPosition = false;
}
//Modification ends
//$tagContentEndPosition = strpos($this->_text, ']', $tagStartPosition); //for reference