title: Java-based regular expression to allow alphanumeric chars and ', and
body: <p>I'm new to regular expressions in Java and I need to validate if a string has alphanumeric chars, commas, apostrophes and full stops (periods) only. Anything else should equate to false.</p>
  
  <p>Can anyone give any pointers?</p>
  
  <p>I have this at the moment which I believe does alphanumerics for each char in the string:</p>
  
  <pre><code> Pattern p = Pattern.compile("^[a-zA-Z0-9_\\s]{1," + s.length() + "}");
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Mr Albany Caxton</p>