title: Split a string in java using regex
body: <p>I am trying to split a string using a regex "A.*B", which works just fine to retrieve strings between 'A' and 'B'. But the dot '.' doesn't include new line characters \n,\r. 
  Can you please guide me on how to achieve this?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p>Thanks all. Pattern.DOTALL worked like a charm.</p>
  
  <p>I had another question related to this. What should be done if I need to extract all the strings between 'A' and 'B' (which basically match the above regex).</p>
  
  <p>I tried using find() and group() of matcher class, but with the pattern below it seems to return the whole string.</p>
  
  <p><code>Pattern p = Pattern.compile("A.*B",Pattern.DOTALL);</code></p>