Jump to content

[SOLVED] preg_replace help


adambeazley

Recommended Posts

Hello,

 

I have been having a hell of a time trying to figure out this preg_replace function.

 

Here is the deal:

 

I have a CMS and the {thumbnail} variable will output something like:

<img src="http://www.mysite.com/images/image.jpg" alt="some descriptions" class="rimage">

 

I need to use the {thumbnail} variable and strip out the image url out of the image src code. This is what i have so far, but it is not working:

 

<?php echo preg_replace('/.*src=([\'"])((??!\1).)*)\1.*/si','$2','{thumbnail}'); ?>

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/175859-solved-preg_replace-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.