title: Split sentence into words
body: <p>for example i have sentenes like this: </p>
  
  <pre><code>$text = "word, word w.d. word!..";
  </code></pre>
  
  <p>I need array like this</p>
  
  <pre><code>Array
  (
      [0] =&gt; word
      [1] =&gt; word
      [2] =&gt; w.d
      [3] =&gt; word".
  )
  </code></pre>
  
  <p>I am very new for regular expression..</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>function divide_a_sentence_into_words($text){ 
      return preg_split('/(?&lt;=[\s])(?&lt;!f\s)\s+/ix', $text, -1, PREG_SPLIT_NO_EMPTY); 
  }
  </code></pre>
  
  <p>this</p>
  
  <pre><code>$text = "word word, w.d. word!..";
  $split = preg_split("/[^\w]*([\s]+[^\w]*|$)/", $text, -1, PREG_SPLIT_NO_EMPTY);
  print_r($split);
  </code></pre>
  
  <p>works, but i have second question i want to write list in mu regular exppression 
  "w.d" is special case.. for example this words is my list "w.d" , "mr.", "dr."</p>
  
  <p>if i will take text:</p>
  
  <p>$text = "word, dr. word w.d. word!..";</p>
  
  <p>i need array:</p>
  
  <pre><code>Array (
    [0] =&gt; word
    [1] =&gt; dr.
    [2] =&gt; word
    [3] =&gt; w.d
    [4] =&gt; word 
  )
  </code></pre>
  
  <p>sorry for bad english...</p>