title: Codeigniter - Regex Expression to include a period - preg_match
body: <p>I have a regex expression as follows:</p>
  
  <pre><code>return ( ! preg_match("/^([-a-z_ -])+$/i", $str)) ? FALSE : TRUE;
  </code></pre>
  
  <p>I need to add to it to allow a period, so that the input could be something like this:</p>
  
  <p>"st. austell" or "st. thomas"</p>
  
  <p>I have tried various ways to add the period to the above rule, but the page either crashes out and just displays a blank page, or my validation errors are triggered.</p>
  
  <p>I have tried things like this, but to no avail. </p>
  
  <pre><code>([-a-z_ -.])
  ([-a-z_ -\.])
  ([-a-z_ -])\.
  (\.[-a-z_ -]) etc etc...
  </code></pre>
  
  <p>I have tried everything and don't seem to bee having any luck - any ideas</p>
  
  <p>Many Thanks</p>
  
  <p>James</p>