# Regex back reference problems

**URL:** <https://forum.kirupa.com/t/regex-back-reference-problems/206543>\
**Category:** Uncategorized\
**Created:** [November 9, 2006, 3:53am UTC](https://forum.kirupa.com/t/regex-back-reference-problems/206543 "2006-11-09T03:53:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blazes](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@blazes](https://forum.kirupa.com/u/blazes)\
**Post date:** [November 9, 2006, 3:53am UTC](https://forum.kirupa.com/t/regex-back-reference-problems/206543/1 "2006-11-09T03:53:28Z")

</div>

Hello. Take this example:

$old = “hello, world”;  
$regex = “(._?), (._?)”;  
$new ="\2, strtoupper(\1)";  
preg\_replace($regex, $new, $old);

This is just an example. Basically I want to be able to edit the backref. If I was using preg\_match, then I could just use $matches, but i’m not. What can I do?
