title: (PowerShell) split string with escaped separator characters
body: <p>The <strong>split</strong> module is often used to split Active Directory Distinguished Names and Canonical Names to RDNs conveniently forgetting about the escaped separator characters that might be used in OUs and CNs as:</p>
  
  <p>Distinguished Name Example with an escaped comma:</p>
  
  <pre><code>CN=Test User,OU=Comma\,Test,OU=Test,DC=domain,DC=com
  </code></pre>
  
  <p>Canonical Name Example with an escaped slash:</p>
  
  <pre><code>Domain.com/Test/Slash\/Test/Test User
  </code></pre>
  
  <p>There are several splitting examples on the internet that do not even mention this trap which might work for a long time but sooner or later will cause a lot of pain troubleshooting this programming flaw .</p>
  
  <p>I don’t think there is an easy way to correctly split escaped strings using a Regular Expression (see also: Is there a pure regex split of a string containing escape sequences?).
  .</p>