title: How to use PHP regex to replace a space AND comma AND combination of space AND comma with arbitrary string?
body: <p>How do you use PHP's preg_match to replace:</p>
  
  <ol>
  <li>White space, and</li>
  <li>Comma, and</li>
  <li>Combination of white space AND comma</li>
  </ol>
  
  <p>For example, consider the following string:</p>
  
  <pre><code>apple orange,strawberry, coconut
  </code></pre>
  
  <p>Note that:</p>
  
  <ol>
  <li>Only white space is used between "apple" and "orange"</li>
  <li>Only comma is used between "orange" and "strawberry"</li>
  <li>Both white space and comma is used between "strawberry" and "coconut"</li>
  </ol>
  
  <p>How do I use preg_match to replace all occurences of the listed elements above with the word YES, that results in the following string</p>
  
  <pre><code>appleYESorangeYESstrawberryYEScoconut
  </code></pre>
  
  <p>Thanks in advance!</p>