title: Java regex - alphanumeric, at most one hyphen, period or underscore, seven characters long
body: <p>I'm new to the regex tool in Java, and despite their great potential I'm having a hard time accomplishing this task. I want to write a regex to validate an input string which respects the following syntax: </p>
  
  <ol>
  <li>any combination of lowercase letters and digits</li>
  <li>only one underscore, one dash or one period (no other special characters)</li>
  <li>minimum length of 5</li>
  </ol>
  
  <p>I came up with the following solution: </p>
  
  <p>([/./-_]{0,1}[a-z0-9]){5,}</p>
  
  <p>but in some cases it still doesn't work, for example it does not match a string where one of the special characters allowed is in the middle (such as he-llo). Where did I go wrong? Is there any other pattern better than this for my purpose?</p>