I use the following code to pull an image out of a post content

```
$content = $post->post_content;
$searchimages = '~<img [^>]* />~';

preg_match_all( $searchimages, $content, $pics );

$iNumberOfPics = count($pics[0]);

if ( $iNumberOfPics > 0 ) {
     // Your post have one or more images.

     echo $pics[0][0];
}

```

But now I ran into a problem, the output of images is including all kind of classes. I would like to know if it's possible for me to remove 

```
class="anyrandomclass"

```

from echo `$pics[0][0];` so in the end I get an image without any classes. I found arround a few ways with regex but none of those worked :(

I hope It can be resolve. thanks for the help on this