title: How to split English letters, numbers and Chinese characters?
body: <p>To better illustrate the question, I will state a couple of inputs together with the desired outputs:</p>
  
  <ul>
  <li>INPUT 1: <strong>This中文5142</strong></li>
  <li><p>OUTPUT 1: <strong>array('This', '中文', '5142')</strong></p></li>
  <li><p>INPUT 2: <strong>This 中文,5142</strong></p></li>
  <li>OUTPUT 2: <strong>array('This', '中文', '5142')</strong></li>
  </ul>
  
  <p>So basically, the input string can either have white space or not, and the sequence of the English letters, numbers and Chinese characters is unknown and can occur more than once.</p>
  
  <p>I found out this one that can do the job when there is no Chinese characters (reference: <a href="https://stackoverflow.com/questions/10180730/splitting-string-containing-letters-and-numbers-not-separated-by-any-particular">Splitting string containing letters and numbers</a>):</p>
  
  <pre><code>$array = preg_split("/(,?\s+)|((?&lt;=[a-z])(?=\d))|((?&lt;=\d)(?=[a-z]))/i", $str);
  </code></pre>
  
  <p>I can roughly understand the above regular expression:</p>
  
  <ol>
  <li>(,?\s+) - split by white spaces and so</li>
  <li>(?&lt;=[a-z])(?=\d) - if a number is right after a letter, split them</li>
  <li>(?&lt;=\d)(?=[a-z]) - if a letter is right after a number, split them</li>
  </ol>
  
  <p>So I was thinking naively like this: I will need to do a total of 3 things:</p>
  
  <ol>
  <li>if a number is right after a letter or Chinese character, split them</li>
  <li>if a letter is right after a number or Chinese character, split them</li>
  <li>if a Chinese character is right after a letter or number, split them</li>
  </ol>
  
  <p>To achieve 1, I was thinking like this:</p>
  
  <pre><code>(?&lt;=[a-z\x4E00-\x9FA5])(?=\d)
  </code></pre>
  
  <p>where \x4E00-\x9FA5 is to match Chinese characters. But this doesn't work!</p>