PHP regular expressions - Replacing one backreference
<p>Is there a way in <code>preg_replace()</code> or <code>preg_replace_callback()</code> to replace only one backreference? For instance I have this regular expression: <code>/(\.popup)([\s\.{])/</code> and this string <code>.popup .popup-option</code>. The backreferences that will be generated are as follows: <code>$0 = .popup\s</code>, <code>$1 = .popup</code>, <code>$2 = \s</code>. I want to replace only the <code>$1</code> by another string. How do I manage to do this?</p>

<p>Thanks.</p>