title: Java Regex FileName not repeated
body: <p>Im trying to set a validation for not repeated file names, if some file is repeated it should be writen this way:</p>
  
  <ul>
  <li>FILENAME.PDF</li>
  <li>FILENAME_1.PDF</li>
  <li>FILENAME_2.PDF</li>
  </ul>
  
  <p>So I can make the first one, but all the rest how can be taken?.</p>
  
  <p>I will get a list of all filenames documents before, so now im trying to make like a for each document but i dont know how to make regex for get it.</p>
  
  <p>FILENAME_1.PDF -> REGEX() -> GET RETURN -> 1</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>If I have this files in my bbdd: [filename.pdf, filename_1.pdf, filename_2.pdf].</p>
  
  <p>I need when someone upload some new, based on that files, my new name will be filename_3.pdf if exist file name 2.</p>
  
  <p><strong>FILENAME_VERSION.EXTENSION</strong></p>
  
  <p>Base on this i need get the version of the last filename. Thanks!</p>
  
  <p>Note: There will be more filesnames differents, for example FILANEM_FILENAM_VERSION.pdf</p>
  
  <hr>
  
  <p>Thanks you!</p>