title: regex question for trimming the white space for validating name input
body: <p>Check if the value for name entered contains first name and last name with a space between. I use the following regex but face problem when there is a trailing space, it returns false. 
  How do I ignore the trailing space in my regex?  </p>
  
  <pre><code>var nameArr = value.match(/^([^ ]{1,50})[, ]+(.{0,49}[^ ,])$/);
  </code></pre>
  
  <p>My approach for resolving the trailing space
  var nameArr = value.trim().match(/^([^ ]{1,50})[, ]+(.{0,49}[^ ,])$/);
  Is there other way besides using trim method?</p>