title: PHP - Remove Shortcodes and Content in between with Regex Pattern
body: <p>I have the following string:</p>
  
  <pre><code>$text = My example text [shortcode_name]content of shortcode[/shortcode_name] is cool.
  </code></pre>
  
  <p>And the following pattern:</p>
  
  <pre><code>$pattern= '/\[(\/?shortcode_name.*?(?=\]))\]/';
  </code></pre>
  
  <p>It gives me the following result:</p>
  
  <pre><code>preg_replace($pattern,'',$text);
  My example text content of shortcode is cool.
  </code></pre>
  
  <p>This works like a charm to remove the shortcode.<br />
  What I'm looking for is to remove the shortcode and all content in between.
  <br />The result that I'm looking for is:</p>
  
  <pre><code>My example text is cool.
  </code></pre>