Can I use parenthesized substring matches from a regular expression?

Can I use parenthesized substring matches from a regular expression?

I would like to use pieces of string that matches regular expression parenthesized groups, like this:

  1. reg_ex = "(.*)([A-Za-z}{3})(.*)";
  2. if (mystring.matches(reg_ex)
  3. {
  4.     mystring = mystring.replaceAll(reg_ex, "\2");
  5. }
Is it possible?