Regex under Java sucks.
Anyways, playing around with it, I think I discovered how to accomplish your goal. I'm not sure where the '\W' came from, but here's what I did to remove periods:
Code:
String foo = ".f.o.o.b.a.r.";
Pattern pattern = Pattern.compile("[\\.]");
System.out.println(pattern.matcher(foo).replaceAll(""));