Named backreferences with preg_replace
Pretty straightforward; I can't seem to find anything definitive regarding PHP's preg_replace() supporting named backreferences: // should match, replace, and output: user/profile/foo $string = 'user/foo'; echo preg_replace('#^user/(?P<id>[^/]+)$#Di', 'user/profile/(?P=id)', $string); This is a trivial example, but I'm wondering if this syntax, (?P=name) is simply not supported. Syntactical issue, or non-existent functionality? They exist: http://www.php.net/manual/en/regexp.reference.back-references.php With preg_replace_callback: function my_replace($matches) { return '/user/profile/' .