import java.util.regex.*; import java.io.*; public class EscapeSpecialChar{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter string to find special characters: "); String string = in.readLine(); Pattern pattern = Pattern.compile("[^a-zA-z0-9 ]"); Matcher matcher = pattern.matcher(string); String str = matcher.replaceAll("F"); System.out.print(str); } }