title: Perl one-liner to match contractions such as I'd and can't
body: <p>I'm writing Perl code to match English contractions such as <code>I'd</code> and <code>can't</code><br>
  I could solve the problem by transforming my code into a short script, but I would like to know if this can be solved with a one-liner.</p>
  
  <p>My sample text is:</p>
  
  <pre><code>I'd like to match only contractions using a Perl one liner but it's tricky
  </code></pre>
  
  <p>The output should be:</p>
  
  <pre><code>I'd
  it's
  </code></pre>
  
  <p>I can't put a bare single-quote inside of the regex, since that would prematurely end the perl expression:</p>
  
  <pre><code>perl -lane 'for (@F) {print if /^[a-zA-z]+'[a-zA-Z]+$/}' file
  Illegal variable name.
  </code></pre>
  
  <p>Escaping the single-quote with a backslash isn't working:</p>
  
  <pre><code>perl -lane 'for (@F) {print if /^[a-zA-z]+\'[a-zA-Z]+$/}' file
  Illegal variable name.
  </code></pre>