PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
a preg_match* returns the string it matched, plus any groupings you requested.. Since the preg_match_all I wrote returns the offsets, you can use those to extract the entire string (from beginning to its actual end) to replace. Once you have this entire string, you can use a preg_replace on it to change out the beginning and ending marks (using the greedy syntax)