title: Java String strip with regular expression
body: <p>How can I remove leading &amp; trailing chars in a certain range (preferably with a regex)?</p>
  
  <p>for instance if I want to remove leading &amp; trailing english letters:</p>
  
  <pre><code>aa11bb22cc ----&gt; 11bb22
  </code></pre>
  
  <p>I noticed that the recommended apache commons <code>StringUtils.strip()</code> utility method doesn't support regex input. For example:</p>
  
  <pre><code>String a = "aa11bb22cc";
  a = StringUtils.strip(a, "[a-zA-Z]");
  System.out.println(a);
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>11bb22cc
  </code></pre>
  
  <p>ie <code>[a-zA-Z]</code> was handled as a list of 7 literal characters.</p>