title: Ruby REGEX for letters and numbers or letters followed by period, letters and numbers
body: <p>I am trying to construct a Ruby REGEX that will only allow the following:</p>
  
  <pre><code>some string (read letter only characters)
  some string followed by numbers
  some string followed by a period and another string
  some string followed by a period and another string followed by numbers
  period is only allowed if another string follows it
  no other periods are allowed afterwards
  numbers may only be at the very end
  </code></pre>
  
  <p>I have got <code>\A[[^0-9.]a-z]*([0-9]*|((.)([[^0-9]a-z]*)[0-9]*))\z</code> but I can't get what I need. This allows:</p>
  
  <pre><code>test.
  test..
  test.123
  </code></pre>
  
  <p>What is the correct REGEX? If someone could explain what I am doing wrong to help me understand for future that would be great too.</p>
  
  <p>Edit: update requirements to be more descriptive</p>