fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String s = "range (bar | thumb_1 | thumb_2 | fill)\nrange(bar|thumb_1|thumb_2|fill)\n.root.range.bar";
  11. System.out.println(s.replaceAll("(?<!\\.)\\b\\w+", ".$0"));
  12. }
  13. }
Success #stdin #stdout 0.1s 27772KB
stdin
Standard input is empty
stdout
.range (.bar | .thumb_1 | .thumb_2 | .fill)
.range(.bar|.thumb_1|.thumb_2|.fill)
.root.range.bar