fork download
  1. class Ideone
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. final String[] a = {"1984","1","123456789","a 123 b"};
  6. for (String s: a) {
  7. System.out.println(s.replaceAll("\\d","D"));
  8. }
  9. }
  10. }
Success #stdin #stdout 0.08s 28000KB
stdin
Standard input is empty
stdout
DDDD
D
DDDDDDDDD
a DDD b