fork(87) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String myString = "this filename.has[characters')which/should%be@replaced.txt";
  9. myString = myString.replaceAll("[^a-zA-Z0-9.-]", "_");
  10. System.out.println(myString);
  11. }
  12. }
Success #stdin #stdout 0.06s 380160KB
stdin
Standard input is empty
stdout
this_filename.has_characters__which_should_be_replaced.txt