title: Regex to match one character exactly one time anywhere inside a string
body: <p>I want to match the symbol @ inside a string. It doesn't matter if it is at the beginning, at the middle or at the end of string or anywhere inside it. What matters is to just match it only 0 or 1 times.</p>
  
  <p>I thought of something like this:</p>
  
  <pre><code>^[^@]*@[^@]*$
  </code></pre>
  
  <p>But definitely doesn't work because even though it matches the symbol @ once, it can match it only inside the string.</p>
  
  <pre><code>@foobar Valid
  foo@bar Valid
  foobar@ Valid
  fooba@r Valid
  </code></pre>
  
  <p>but </p>
  
  <pre><code>@@foobar Invalid
  @foo@bar Invalid
  foo@b@ar Invalid
  </code></pre>