I\'ve been trying to do some regex operations in PHP, and I\'m not very skilled in this area. It seems that when I use a regex function like preg_replace on a string, I can acce
They are called backreferences and match grouped elements within the regexp.
If you surround a section of the regexp with brackets, then you can refer to it in the replace section (or indeed later in the same regexp, by the backreference which corresponds to its position.
Slash form, or dollar form can be used in replacements:
\1, \2 == $1, $2