title: Ruby String Partition
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6957858/split-string-into-a-list-but-keeping-the-split-pattern">Split string into a list, but keeping the split pattern</a>  </p>
  </blockquote>
  
  
  
  <pre><code>"hello world, I am the universe".partition(/I am/)
      #=&gt; ["hello world, ", "I am", " the universe"]
  </code></pre>
  
  <p>What is the ruby way of having this output? Please keep in mind of more complex strings as well.</p>
  
  <pre><code>#=&gt; ["hello world, ", "I am the universe"]
  </code></pre>
  
  <p>Complex:</p>
  
  <pre><code>"hello world, I am the universe, I am the world".some_partitioning_function(/I am/)
  #=&gt;["hello world, ", "I am the universe, ", "I am the world"]
  </code></pre>