title: Java regex to extract text between tags
body: <p>I have a file with some custom tags and I'd like to write a regular expression to extract the string between the tags.  For example if my tag is:</p>
  
  <pre class="lang-none prettyprint-override"><code>[customtag]String I want to extract[/customtag]
  </code></pre>
  
  <p>How would I write a regular expression to extract only the string between the tags.  This code seems like a step in the right direction:</p>
  
  <pre><code>Pattern p = Pattern.compile("[customtag](.+?)[/customtag]");
  Matcher m = p.matcher("[customtag]String I want to extract[/customtag]");
  </code></pre>
  
  <p>Not sure what to do next.  Any ideas?  Thanks.</p>