title: Regex checking whether string contains digits, letters, spaces, new lines and only allowed characters
body: <p>I'm trying to create regex which will match only if the string contains only of:</p>
  
  <ul>
  <li>a-z and A-Z (letters)</li>
  <li>0-9 (digits)</li>
  <li>whitespaces and new lines</li>
  <li>characters: !@#%^*()_-=+[]{};:,.?/</li>
  </ul>
  
  <p>So if my string contains of chars not on this list, the regex should not match.</p>
  
  <p>Examples:</p>
  
  <blockquote>
    <p>AS55DSFs2afds23423ASAS as2 /sd/%%% - match</p>
    
    <p>$$ $Sfs dG@?423 - no match (dollar sign not allowed)</p>
  </blockquote>
  
  <p>Matching letters and digits is easy:</p>
  
  <pre><code>^([A-Za-z0-9]*)$
  </code></pre>
  
  <p>But I have a problem with whitespaces, new lines and special characters.</p>
  
  <p><strong>ANSWER</strong></p>
  
  <pre><code> ^([A-Za-z0-9\s!@#%^*()_\-=+\[\]{};:,.?\/]*)$
  </code></pre>