You are here: eregi and eregi replace « PHP Programming Language « IT news, forums, messages
eregi and eregi replace

Posted by Nel on 01/11/06 01:50

Hi all,

I am struggling with understanding a small eregi problem in php4.

My code:
<?PHP
$htmlsource = '<img src="pics/hotdog.gif"> text text <img
src="pics/silly%20sausage.gif"> ';
eregi('(=")(pics/)([0-9a-zA-Z%/ ]+.[a-zA-z]..)(")',$htmlsource,$imagesintext);
?>

var_dump gives this, so I know it's working
Outputs
array(5) {
[0]=>
string(18) "="pics/hotdog.gif""
[1]=>
string(2) "=""
[2]=>
string(5) "pics/"
[3]=>
string(10) "hotdog.gif"
[4]=>
string(1) """
}

What I am trying to do is replace all images in the format ="pics/image.jpg"
with "image.jpg" and at the same time make a list of the files image.jpg.
The problem is how to pick up ALL the occurances, not just the first???

Also how to use replace to remove the pics/ bit of the string.

Thanks,

Nel.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация