title: Extract a substring with a regular expression in PowerShell
body: <p>Instead of splitting a string, how can I regex it and extract the last substring between <code>\</code> and <code>]</code>?</p>
  
  <p>Example:</p>
  
  <pre><code>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\anyLongString]
  </code></pre>