Thread: regex
View Single Post
Old 11-01-2004, 04:00 AM   #1 (permalink)
philthee
Registered User
 
Join Date: Oct 2004
Posts: 15
philthee is on a distinguished road
regex

Hi again,

been struggling to get a simple regex to work.

I want to remove all instances of the period . character from my line but i can't quite figure it out.

from my code

String bandName = toks.nextToken();
String temp = bandName;
Pattern removePeriods = Pattern.compile("\\W"); // i think??
Matcher matcher = removePeriods.matcher(temp);

// as far as i can see that should find the first instance of . (period character)
// if so, how do i substitute it with nothing?
philthee is offline   Reply With Quote