Splitting a string by white space and a period when not surrounded by quotes
<p>I know that similar questions have been asked many times, but my regular expression knowledge is pretty bad and I can't get it to work for my case.
So here is what I am trying to do:</p>

<p>I have a text and I want to separate the sentences. Each sentence ends with some white space and a period (there can be one or many spaces before the period, but there is always at least one).</p>

<p>At the beginning I used <code>/\s+\./</code> and it worked great for separating the sentences, but then I noticed that there are cases such as this one: 
 "some text . some text".</p>

<p>Now, I don't want to separate the text in quotes. I searched and found a lot of solutions that work great for spaces (for example: <code>/(".*?"|[^"\s]+)+(?=\s*|\s*$)/)</code>, but I was not able to modify them to separate by white space and a period.</p>

<p>Here is the code that I am using at the moment.</p>

<pre><code>var regex = /\s+\./;
        var result = regex.exec(fullText);
        if(result == null) {
            break;
        }
        var length = result[0].length;
        var startingPoint = result.index;
        var currentSentence = fullText.substring(0,startingPoint).trim();

        fullText = fullText.substring(startingPoint+length);
</code></pre>

<p>I am separating the sentences one by one and removing them from the full text.
The <code>length</code> var represents the size of the portion that needs to be removed and <code>startingPoint</code> is the position on which the portion starts. The code is part of a larger <code>while</code> cycle.</p>