Using preg replace with an array
<p>I have a checkbox list creating an array that I want to iterate over to have the value create both an image file name as well as the title and alt tag.</p>

<pre><code>$specs = get('speciesCommon');
$thepath = get_bloginfo('template_directory'); 
foreach($specs as $speci){
echo '&lt;li&gt;&lt;img src="'.$thepath.'/library/images/icons/species/'.$speci.'.gif" width="30" height="30" alt="'.$speci.'" title="'.$speci.'" /&gt;&lt;/li&gt;' ;
}
</code></pre>

<p>So for example the checkbox value is grizzly-bear then it would populate this to print:</p>

<pre><code>&lt;img src=".../grizzly-bear.gif" title="grizzly-bear" alt="grizzly-bear" .../&gt;
</code></pre>

<p>I want to have just the title and alt tag printed without the hyphen.. I tried..</p>

<pre><code>$speci = preg_replace('/-/','\s',$speci);
</code></pre>

<p>but it didnt work and then I realized that the image needs the hyphen so I cant do it that way anyways. Any ideas on how I can make this happen?</p>
