title: Matching custom string with regex
body: <p>I have a string that I want to split with regex:</p>
  
  <p>Here's the string</p>
  
  <p><strong>D200001test_test_SMARTPHONE</strong></p>
  
  <p>first part is covered with <strong>(D\d{6})</strong>
  problem is that only this part is required. Everything else if it doesn't exists is empty.</p>
  
  <p>I need to split this string into (in this example)
  D200001 (customerId)
  test_test (shopId)
  SMARTPHONE (layout)</p>
  
  <p>last words (if they exist) can only be SMARTPHONE or TABLET</p>
  
  <p>but the solution should also work with the following strings:</p>
  
  <pre><code>$testStrings = Array('D200001', 'D200001test', 'D200001test_test', 'D200001test_', 'D200001test_SMARTPHONE', 'D200001test_test_SMARTPHONE');
  </code></pre>
  
  <p>I came up with this:</p>
  
  <pre><code>preg_match_all('/(D\d{6})([0-9a-z-_)]{0,})(_TABLET|_SMARTPHONE){0,1}/i', $string, $result);
  </code></pre>
  
  <p>which is NOT parsing the layout WORDS correctly..</p>