title: Change preg_replace url
body: <p>Sorry for my English bad typing.</p>
  
  <p>I want added tag <code>&lt;meta name="ROBOTS" content="NOINDEX, NOFOLLOW"&gt;</code></p>
  
  <p>to bad urls</p>
  
  <hr>
  
  <p>I want (preg_replace) find</p>
  
  <p><code>&lt;link rel="canonical" href="/example1/example2/example3/example4" /&gt;</code></p>
  
  <p>and replace </p>
  
  <p><code>&lt;link rel="canonical" href="example1/example2/example3/example4" /&gt;&lt;meta name="ROBOTS" content="NOINDEX, NOFOLLOW"&gt;</code></p>
  
  <p>This is my code:</p>
  
  <pre><code>$body = preg_replace('# &lt;link rel="canonical" href="/example/(.*?)/(.*?)/(.*?)" /&gt; #is', ' &lt;link rel="canonical" href="/example/$1/$2/$3" /&gt;&lt;meta name="ROBOTS" content="NOINDEX, NOFOLLOW"&gt;', $body);
  </code></pre>
  
  <p>but this code replace </p>
  
  <p><code>&lt;meta name="ROBOTS" content="NOINDEX, NOFOLLOW"&gt;</code></p>
  
  <p>to all urls.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>example.com/videos/1234<br />
    example.com/music/1234<br />
    example.com/forum</p>
  </blockquote>
  
  <p>I want just find &amp; replace to 4 id's urls  -  not 3 or 2 id's</p>
  
  <p>Again sorry for my English bad typing</p>