fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String strings[] = {"Aisha256", "ai_sha256", "test123", "84test", "test md5", "sha256", "word two sha1", "w0rd", "test_md5", "sha256", "md5"};
  10. for (String str : strings){
  11. System.out.println(str.replaceAll("(?<!\\d|^)(?<!(?<![^\\W_])(?:sha|md))(?=\\d)|(?<=\\d)(?!\\d|$)|_", " "));
  12. }
  13. }
  14. }
Success #stdin #stdout 0.09s 34120KB
stdin
Standard input is empty
stdout
Aisha 256
ai sha256
test 123
84 test
test md5
sha256
word two sha1
w 0 rd
test md5
sha256
md5