title: Regular expression to find $ signs but not ones with {} around them
body: <p>I'm trying to write a regular expression to escape $ signs that are not surrounded by {}. </p>
  
  <p>This is what I have so far: <code>\^\$|[^\{]\$\</code></p>
  
  <pre><code>$test 
  </code></pre>
  
  <p>expected: match actual: match</p>
  
  <pre><code>{$test1}
  </code></pre>
  
  <p>expected: no match actual: no match</p>
  
  <pre><code>{$test}  $test1
  </code></pre>
  
  <p>expected: match 2nd actual: matches space before 2nd $ sign</p>
  
  <pre><code>{ $test3 }
  </code></pre>
  
  <p>expected: no match actual: matches space before $ sign</p>
  
  <p>So basically if a $ is enclosed by brackets, it should never match, but any other $ should match.</p>
  
  <p>I'm using php and I'm assuming there is no nesting of brackets.There can be whitespace (n spaces or linebreaks or tabs, any kind of whitespace) between brackets and $ signs.</p>