fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String[] strings = {
  12. "0001113033AA55608981",
  13. "23456237472347823923",
  14. "00000000090000000000",
  15. "09008000800060050000",
  16. "AAAABBBBCCCCDDDDEEEE",
  17. "0000BBBBCCCCDDDDEEEE"
  18. };
  19.  
  20. for (String s : strings) {
  21. String regex = "(?<=^0{0,100}[^\\W0]\\w{3,100})\\w(?=\\w{4,}$)";
  22. Pattern p = Pattern.compile(regex);
  23. Matcher m = p.matcher(s);
  24. System.out.println(m.replaceAll("*"));
  25. }
  26. }
  27. }
Success #stdin #stdout 0.13s 53948KB
stdin
Standard input is empty
stdout
0001113*********8981
2345************3923
0000000009000***0000
09008***********0000
AAAA************EEEE
0000BBBB********EEEE