title: Replace part of a string with Regex in PHP
body: <p>I've this URL:</p>
  <pre><code>https://example.com/[photo-s]/photo.jpg
  </code></pre>
  <p>Sometimes the part between <code>[]</code> changes.</p>
  <p>How in PHP, can I replace this part with another thing ?</p>
  <p>Example:</p>
  <pre><code>preg_replace('photo-[a-z]', 'newphotopath', 'photo-s');
  </code></pre>
  <p>Thanks.</p>