If I had a string like <start_delim>asdf<end_delim> and I wanted to take an alphanumeric string between the delimiters and reverse it using regexes, how would I go about doing this?
My natural instinct was to use something like preg_replace("<start_delim>([a-zA-Z0-9]+)<end_delim>", strrev($1), $str), but for obvious reasons, that didn’t work.
You’ll have to use preg_replace_callback
http://codepad.org/xP2arFZk