title: extracting a substring from a string after and before a specified pattern in java
body: <p>i want to extract a portion from a string which satisfies a particular pattern after and before the desired portion :</p>
  
  <p>example :</p>
  
  <pre><code>String [] s1 = my name is ankit kapoor , my name is mayank gupta , my name is preeti singh ;
  </code></pre>
  
  <p>Here i only need the first name i.e ankit ,mayank , preeti 
  i.e after is and before the occurrence of first space.</p>
  
  <p>The code which i have use till now is </p>
  
  <pre><code>String [] final_reult = s1[i].substring((s1.indexof("is")+3) , (s1.lastindexof(" ")));
  </code></pre>
  
  <p>obviously im using loop i.e <code>for(int i=o;i&lt;s1.length;i++)</code></p>
  
  <p>and output im getting is : ankit kapoor  // instead of ankit
                             mayank gupta  // instead of mayank
                             preeti singh  // instead of preeti</p>
  
  <p>Please help !! 
  i want to use this format only</p>