Q:

Perl regex replacement when replacement is numeric

This is probably something really silly, and I apologize if that is the case. I don't know exactly what to search for, and I haven't had any luck with the searches I've ran over the past half hour or so. Anyway... 
So I want to automate making a simple change to xml with perl as part of a build process. This is the change I'm making, it's part of a config file called mapred-site.xml
<property>
  <name>yarn.app.mapreduce.am.resource.mb</name>
-    <value>1024</value>
+    <value>4096</value>
</property>

I've got a perl regex replacement that does exactly what I need it to do, until I change this FOO to 4096
cat mapred-site.xml | perl -p0e "s/(yarn.app.mapreduce.am.resource.mb<\/name>\s*?<value>)....(<\/value>)/\\1FOO\\2/s"

Guessing that the problem is that there are numbers directly next to the \\1 referring to the first portion, and it's pulling them in and trying to do \\14096 or similar, but I haven't been able to come up with a solution. 
I apologize if the command itself is sloppy/inefficient, I'm still just getting started with these commands.

A:

Using \1, \2 etc. on the right side of a regex is about a million years old anyway; the recommended way is to use $1, $2, etc. And if you use those you can use braces to separate the variable name from any neighboring stuff, like ${1}FOO${2} (or, just as well, ${1}4096${2}).

