custom rel tag in galleries

Add rel tag to gallery images (Used for some Lightbox plugins code).

function addlightboxrel_replace($content){
	global $post;
	$pattern = "]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\a>i";
	$replacement = '$7';
	$content = preg_replace($pattern, $replacement, $content);
	return $content;
}
add_filter('the_content', 'addlightboxrel_replace', 12);
add_filter('get_comment_text', 'addlightboxrel_replace');