The bracketing construct ( ... ) creates capture buffers. To refer to the digit'th buffer use \ within the match. Outside the match use "$" instead of "\".