The Java API documentation for regular expressions says that:

Back references
\n Whatever the nth capturing group matched

This seems to be difficult to get working though. Here’s an example of a work-around:
str.replaceAll(“user(.*)”, “$1″)

Example:
“username” => name