Hi mweb, try this:
<? $string = "<IMG SRC=\"C:\dir1\dir2\dir3\img1.gif\"> blah blah blah some text, html markup... <IMG SRC=\"img2.jpg\"> blah blah again"; $string = preg_replace("/<IMG SRC=\".*?([0-9])\.(gif|jpg)\">/i", "<IMG SRC=\"UNIQUE_CODE_0$1.$2\">", $string); echo nl2br($string); ?> ~James "Mweb" <> wrote in message ... Hello, What is the right regexp to handle this, either in a while loop (how?) or all by itself? The closer I've come to the solution is: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]