import java.util.regex.*; import java.io.*; public class RegExpSetForCaseSensitive{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter string: "); String string = in.readLine(); System.out.print("Enter string for search: "); String str = in.readLine(); Pattern pattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(string); String afterReplace = matcher.replaceAll("F"); System.out.println(afterReplace); } }