title: How to split a String on the basis of a recurring substring?
body: <p>I have a string that I want to split into multiple components as follows:</p>
  <blockquote>
  <p>Timings: 12:00 PM - 4:00 PM (MON-FRI), 3PM - 6 PM (WED), 4 PM- 8PM (TUE,THU)</p>
  </blockquote>
  <p>I want to split this string into its components i.e.</p>
  <blockquote>
  <p>Part - 1:  12:00 PM - 4:00 PM (MON-FRI)</p>
  <p>Part - 2:  3PM - 6 PM (WED)</p>
  <p>Part - 3:  4 PM- 8PM (TUE,THU)</p>
  </blockquote>
  <p>I tried using Java's <code>string.split()</code> method but it only works with delimiters I guess hence if I split on a comma, I get 4 parts and so on. Is there anyway to split a string using a substring, in this case <code>),</code>.
  Thanks a lot.
  Here's a snippet of the code:</p>
  <pre><code>String temp = &quot;12:00 PM - 4:00 PM (MON-FRI), 3PM - 6 PM (WED), 4 PM- 8PM (TUE,THU)&quot;;
  String[] partsOfInput = temp.split(&quot;),&quot;);
  String part1 = partsOfInput[0];
  String part2 = partsOfInput[1];
  String part3 = partsOfInput[2];
  if(part3!=null)
      System.out.println(part1+part2+part3);
  else
      System.out.println(part1+part2);
  </code></pre>