title: How to make this preg_replace work with these character replacement?
body: <p>Hi,</p>
  <p>I am struggling to understand the logic in regular expressions. I have this code:</p>
  <pre><code>preg_replace(&quot;~\b$replace\b~&quot;,&quot;&quot;,$file);
  </code></pre>
  <p>Where $replace is a numeric value but it should be encapsulated inside [] to look like this: [33] so I did this:</p>
  <pre><code>preg_replace(&quot;~\b[$replace]\b~&quot;,&quot;&quot;,$file);
  </code></pre>
  <p>and this:</p>
  <pre><code>$replace = &quot;[&quot;.$value.&quot;]&quot;;
  preg_replace(&quot;~\b[$replace]\b~&quot;,&quot;&quot;,$file);
  </code></pre>
  <p>but none will parse. What is the logic behind this?</p>
  <p>Thank you.</p>