String str="6sabcsssfsfs33";
Pattern pattern = Pattern.compile("a?b?3?");
Matcher matcher = pattern.matcher(str);
System.out.println(matcher.replaceAll(""));
Pattern pattern = Pattern.compile("a?b?3?");
Matcher matcher = pattern.matcher(str);
System.out.println(matcher.replaceAll(""));