title: Java regex, how to split on dot, whitespace, and keep quoted words together
body: <p>I want to split my string on a dot, white space, and keep quoted words together. So for example say I have: </p>
  
  <pre><code>This "majestic world" is truly.awesome
  </code></pre>
  
  <p>it should result in: </p>
  
  <pre><code>This
  majestic world
  is
  truly
  awesome 
  </code></pre>
  
  <p>Now, the regex I have so far is just <code>myString.split("\\. | ")</code>. I know that 
  <code>("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'")</code> is supposed to split on white space and keep quoted words together. Now, I am not sure how to incorporate the dot escape there, and quite frankly that regex makes about as much sense as trying to flip a burger with your hands tied behind your back. </p>
  
  <p>Edit: </p>
  
  <p>the following is the reason why I want a better regex, since for me to handle keeping things within  quotation marks, I have to do the following: </p>
  
  <pre><code>if(listOfLists.get(i).get(j).equalsIgnoreCase("INSERT")) {
                          String insertInto = "";
                          boolean buildingString = false;
                          int k = 0;
                          while(k &lt; listOfLists.get(i).size()) {
                              if(listOfLists.get(i).get(k).endsWith("\"")) {
                                  buildingString = false;
                                  insertInto += listOfLists.get(i).get(k);
                                  break;
                              }
                              if(listOfLists.get(i).get(k).startsWith("\"") || buildingString) {
                                  buildingString = true;
                                  insertInto += listOfLists.get(i).get(k) + " ";
                              }
                              k++;
                          }
                          System.out.println("k is: " + k + " message is: " + insertInto);
                          dbCommands.appendToTable(listOfLists.get(i).get(k + 2), listOfLists.get(i).get(k + 3), insertInto);
  </code></pre>
  
  <p>Where the file i am parsing has a command as follows: </p>
  
  <p>INSERT "John Smith" INTO college.students</p>