title: regex for either of two substrings but prefer the longer substring
body: <p>I'd like to match either <code>cde</code> or <code>de</code> but prefer <code>cde</code> if present. How can this be done in <code>sed</code>? 
  e.g. </p>
  
  <pre><code>$ echo "abcdef" | sed -r 's/^.*(cde|de).*$/\1/' 
  de
  $ echo "abcdef" | sed -r 's/^.*(de|cde).*$/\1/' 
  de
  $ echo "abcdef" | sed -r 's/^.*(c?de).*$/\1/' 
  de
  </code></pre>
  
  <p>None of the above worked, since I want to output <code>cde</code> rather than <code>de</code>. </p>