I am wondering how to configure a script with preg replace to strip out images and leave only the alt tags in place. This is for a drupal theme. The code I have that supposedly works (but doesn't on my machine) is:

This goes in the "Block.TPL.PHP file in the theme folder.

The original poster said this works on his site but on mine, I get an error saying too many ")"

Basically what I want is to strip all images and leave just the alt tags for the page so it is 508 compliant.

PHP Code:
print $block->subject; ?></h2>
<div class="content">
<?php
$pattern 
'/<img[^>]*?((alt="(.*?)".*?>)|>)/i';
$replacement '(Image: $3)';
print 
preg_replace($pattern$replacement$block->content);
?>