title: preg_replace() pattern to remove brackets and content in php
body: <p>I want to remove the brackets with its content using preg_replace(), but i am unable to use a lazy(non-greedy) in the pattern since the end bracket is the end character, the text in between the brackets is always a random character length and can contain numbers, underscores, and hyphens.</p>
  
  <p>code-</p>
  
  <pre><code>$array = array(
     "Text i want to keep (txt to remove)",
     "Random txt (some more random txt)",
     "Keep this (remove)",
     "I like bananas  (txt)"
  );
  
  $pattern = "@pattern@";
  foreach($array as $new_txt){
     $new_outputs .= preg_replace($pattern, '', $new_txt)."\n";
  }
  echo $new_outputs;
  </code></pre>
  
  <p>Wanted output-</p>
  
  <pre><code>Text i want to keep
  Random txt
  Keep this
  I like bananas
  </code></pre>
  
  <p>I do not use regular expressions much and couldn't find anything to solve my problem.</p>