title: Character Convert Regex in Java
body: <p>I am trying to make a text converter for file names with regex, in this text there are some different dash types and hyphen types minus signs etc.etc. I want to convert them all to just a simple hyphen.</p>
  
  <p>there are several types of different dashes and their unicodes are here:</p>
  
  <pre><code>u2212 u002D u05BE u2011 u2012 u2013 u2014 u2015 u207B u208B u2212 uFE58 uFE63 uFF0D 
  </code></pre>
  
  <p>if a character is one of these unicodes, then I want to convert it to <strong>simple hyphen which is u2010</strong> with regex.</p>
  
  <p>How can make this character convert regex with java ?</p>
  
  <p>At first I was checking the file name is valid or not like this:</p>
  
  <pre><code>private static final Pattern FILE_NAME = Pattern.compile("^[a-zA-Z0-9_\\u2212\\u002D\\u00AD\\u05BE\\u2010\\u2011\\u2012\\u2013\\u2014\\u2015\\u207B\\u208B\\u2212\\uFE58\\uFE63\\uFF0D\\.\\s\\,\\[\\]()\\{\\}]+$");
  
  if (!FILE_NAME.matcher(file.getFilename()).matches()) {
                  throw new FileValidationException(FILE_NAME_INVALID);
  }
  </code></pre>
  
  <p>but now I don't want to validate it I just want to replace characters with hyphen u2010</p>