[code]$coded = ereg_replace("(http://)?(www.)?exam(ple)?.com/gallery/image/\?id=([0-9]+)", make_slide("\\4"), $coded);[/code] I'm trying to pass the text in "\\4" into my function...it sorta works, but I clearly am missing some understanding about what it is I'm doing. The function looks like: [code]function make_slide($photo) { $slideshow = mysql_query("SELECT * FROM images WHERE image_id='".$photo."'"); if (mysql_num_rows($slideshow) > 0) { while($row = mysql_fetch_array($slideshow)) { $slide1 = //bunch of formatting here } } return $slide1; }[/code] Here's what happens: No matter what is passed to the function, it has a stringlen of 2 and cannot be evaluated as a normal string. Let's say "\\4" is "35000". If you had the function return this line: [code]return $photo . " length: " . strlen($photo) . " value: " . 0 + $photo;[/code] You'd get [code]35000 length: 2 value: 0[/code] What crucial misunderstanding am I laboring under? I have tried sending "" + "\\4", (string)"\\4", etc. and it always returns the same results. You can always "see" the expected string value but it's completely unavailable for manipulation, and always has a length of "2", whether it's "h" or "hhhhhhhhhhhhhhhhhhhhhhhh". It doesn't matter what "\\4" actually is, whether it's numbers or letters or both. If I don't call a function, but instead do this: [code] eregi("(http://)?(www.)?exam(ple)?.com/gallery/image/\?id=([[:digit:]]+)", $coded, $slide); if ($slide[0]) { $photid = eregi_replace("(http://)?(www.)?exam(ple)?.com/gallery/image/\?id=([0-9]+)", "\\4", $slide[0]); $slideshow = mysql_query("SELECT * FROM images WHERE image_id='".$photid."'"); if (mysql_num_rows($slideshow) > 0) { while($crow = mysql_fetch_array($slideshow)) { $slide1 .= // bunch of formatting $coded = eregi_replace("(http://)?(www.)?exam(ple)?.com/gallery/image/\?id=".$photid, $slide1, $coded); } } } [/code] It works perfectly, but obviously only catches the first instance of the matching code in the text block (hence my desire to call a function). I'm obviously not an expert so any advice or insight is appreciated. Thanks!