Thread: regex
View Single Post
Old 11-01-2004, 04:45 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
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(""));
__________________
GitS
Belisarius is offline   Reply With Quote