title: PHP preg_replace string – contents within brackets
body: <p>I'm struggling to understand PHP <code>preg_replace</code> and wondered if you could offer any guidance on how to work out how to keep the word within the brackets but remove everything else from this string:</p>
  
  <pre><code>Events (Road)
  </code></pre>
  
  <p>So it would return:</p>
  
  <pre><code>Road
  </code></pre>
  
  <p>I'm keen to learn so don't just need the answer but need to understand how it's possible.</p>
  
  <p>I know how to remove the words within the brackets (and the brackets) with:</p>
  
  <pre><code>trim(preg_replace('/\s*\([^)]*\)/', '', 'Events (Road)')
  </code></pre>
  
  <p>Cheers,
  R</p>