Just a little troubleshooting tip: I can't make the callback function used with preg_replace_callback return a blank string (spaces) of certain length. If I try to return a string of say 8 spaces it only returns a string of one space. If I make it return a string of dashes or 'x's of certain length it works fine.