Easy way, using replaceAll and $1 for first group
text.replaceAll("aaa(.*)bbb", "$1");
// or
text.replaceAll("^aaa(.*)bbb$", "$1"); // match whole input string below
replaceAll searches all matches of first argument as regular expression and replaces it with second argument. Dollar in second argument are used to captures sequences (groups). To just replace once1, use replaceFirst().
Similar can be done with a Matcher:
Matcher matcher = Pattern.compile("aaa(.*)bbb").matcher(text);
matcher.replaceAll("$1");
Note 1: since using (.*), the pattern will be found at most once - .* tries to match as much as possible. Example: if text = "aaa first bbb and aaa second bbb" the group in aaa(.*)bbb will match " first bbb and aaa second " - the largest sub-sequence between aaa and bbb. This can be prevented using (.*?) (reluctant quantifier) that tries to match the smallest sub-sequence possible.