title: PHP Regex: How to get capital words then add string if a ucwords matches?
body: <p>I have this dynamic string</p>
  
  <blockquote>
    <p>"ZAN ROAD HOG HEADWRAPS The most
    popular ZAN headwrap style-features
    custom and original artwork"</p>
  </blockquote>
  
  <p><strong>EDIT</strong>
  How can I check all the capital words then if I encountered a ucwords() or title case word then I will automatically add a '--' after the last capital word?
  Note: The capital words are the product name and the first ucwords() or title case word is the start of the product description.</p>
  
  <p>I have this code right now but its not working at the moment:</p>
  
  <pre><code>&lt;?php 
  $str = preg_replace( '/\s+/', ' ', $sentence );
  $words = array_reverse( explode( ' ', $str ) );
  foreach ( $words as $k =&gt; $s ) {
      if ( preg_match( '/\b[A-Z]{5,}\b/', $s ) ) {
          $words[$k] = $s . " --";
          break;
      }
  }
  $short_desc = addslashes( trim( join( ' ', array_reverse( $words ) ) )); 
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>