title: How to write a matches excluding a series of space character (' ') from the input?
body: <p>I am having a problem with my grails project right now, I wanted to write a matches, that would best fit the allowable characters for my input fields. I have written a matches, that throws an error message if the input characters contain a single space character., but no longer works if the input contains a series of spaces. This is my code:</p>
  
  <pre><code>newPassword nullable: false, minSize: 8, matches: /[0-9a-zA-Z_\[\]\\\^\$\.\|\?\*\+\(\)~!@#%&amp;-=]*/, blank: false, notEqualToAnyProperty:['username', 'emailAddress'],validator: { value, obj -&gt;
             (obj.currentPassword != value &amp;&amp; value != '')
          }
  </code></pre>
  
  <p>These are the sample inputs:</p>
  
  <p>1) 'rain drops' - my matches works, it returns an error message that the input contains an invalid character.</p>
  
  <p>2) '          ' - series of spaces; my program returns an error message that should be displayed for the blank constraint instead of displaying the error message for my matches constraint which is the, "input contains an invalid character", since the input doesn't match the allowable input characters.</p>
  
  <p>Any help from you guys? Thanks!</p>