Given a regular expression of (foobar) you can reference the first group using $1 and so on if you have more groups in the replace input field.