title: regex find any string that starts with @ and ends with either space, =, ; or newline
body: <p>This is my final question about regex, hopefully for the rest of my life.  I would like to return any string within a larger block of text that meets the stated requirement above.</p>
  
  <p>Begins with <code>@</code> and ends with either <code></code>, <code>;</code>, <code>=</code>, or a newline <code>\n</code>.</p>
  
  <p>I tried the following with no luck:</p>
  
  <pre><code>return @"(^@).*?(?=\s|;|\=|\r|\n)";
  </code></pre>
  
  <p>My purpose is to try and extract the variable @tmp from a string that looks like this.  (TSQL statement) so that it can be highlighted in a richtext box.</p>
  
  <pre><code>declare @tmp varchar(25);
  set @tmp='test';
  select * from mytable where mycolumn = @tmp;
  </code></pre>
  
  <p>I am expanding the capabilities of an existing editor but it was missing the ability to highlight variables.  (only keywords, comments, literals etc.).</p>