title: Can I make a regex match all characters up to ; except \;?
body: <p>I am going to construct a message-passing system whose messages have the following structure:</p>
  
  <pre><code>message type;message content
  </code></pre>
  
  <p><em>(matches <code>message type;</code>)</em></p>
  
  <p>However, the user can set the message type, and (for the sake of loosely coupled systems) I want to allow them to use a <code>;</code> as part of the message type. To do this, I'll have the message constructor escape it with a <code>\</code>:</p>
  
  <pre><code>tl\;dr;Too long; didn't read content
  </code></pre>
  
  <p>(matches <code>tl\;dr;</code>)</p>
  
  <p><strong>How can I have a regex match all content up to the first <code>;</code> that's not <code>\;</code>?</strong> In the example, that's the <code>tl\;dr;</code> part only. Note that there can be an unescaped <code>;</code> within the message content.</p>
  
  <p>I tried <code>^.*;</code>, but that matches all content up to a semicolon within the message (e.g. <code>tl\;dr;Too long;</code>)</p>