title: Javascript + Regex = Nothing to repeat error?
body: <p>I'm new to Regex and I'm trying to work it into one of my new projects to see if I can learn it and add it to my repitoire of skills. However, I'm hitting a roadblock here.</p>
  
  <p>I'm trying to see if the user's input has illegal characters in it by using the <code>.search</code> function as so:</p>
  
  <pre><code>if (name.search("[\[\]\?\*\+\|\{\}\\\(\)\@\.\n\r]") != -1) {
      ...
  }
  </code></pre>
  
  <p>However, when I try to execute the function this line is contained it, it throws the following error for that specific line:</p>
  
  <pre><code>Uncaught SyntaxError: Invalid regular expression: /[[]?*+|{}\()@.
  
  ]/: Nothing to repeat
  </code></pre>
  
  <p>I can't for the life of me see what's wrong with my code. Can anyone point me in the right direction?</p>