title: strip/remove specific character from string in JAVA
body: <p>i have a string variable say 'result'. The value of this string should contain only alphabets, numerics, dot, space, hyphen and underscore. The regular expression i arrived at is '^[a-zA-Z][a-zA-z ._-]'.</p>
  
  <p>How can i use this regular expression on the string variable? Please help me.</p>
  
  <p>Any other suggesstion is also welcome. Basically i need to have only alpha-numeric, dot,space, hyphen, underscore in the string value.</p>
  
  <p>Please help.</p>
  
  <p><strong>Part of answer:</strong>
  i am able to partly achieve the behavior using</p>
  
  <pre><code>string.replaceAll("[^a-zA-Z0-9]", "");
  </code></pre>
  
  <p>But i could not add dot, space, hyphen, underscore to the above validation. The above validation removes all the characters expect alpha-numeric characters. But i need dot, space, hyphen, underscore are also not to be replaced/removed from the orginal String.</p>
  
  <p>Any ideas please??</p>