I'm trying to use java.util.regex in a program I'm writing. I want to remove a pattern off the front of strings like this XXX*.blahblahblah => blahblahblahMy question is how do I remove the '.' ? This is what I've got so farPattern p = Pattern.compile("(?s)[Xx][Xx][Xx].*['.']");Matcher m = p.matcher(str);Any idea how to fix it?
12/1/2005 9:40:08 AM
use a fsm
12/1/2005 9:54:45 AM
just use a substring of every string starting at the 4th character.
12/1/2005 9:56:17 AM
that sort of defeats the purpose.. ie XXX45.blahblahblah would just become 5.blahblahblah.
12/1/2005 10:01:08 AM
does it need to be \.?
12/1/2005 10:04:42 AM
yeah i think you can escape the . with \.
12/1/2005 10:19:00 AM
I think it may be \\\\. gonna have to test that
12/1/2005 10:22:07 AM
just string tokenize it....compare each token to the "." and once you find it, just thats where you start your substring.
12/1/2005 11:17:38 AM
oh, i definitely didnt read the question right.if there's a variable number of characters before the '.' you can use charAt() to determine if the character at each position of the string is a '.' once you find it, create a substring starting at the next character and go until the end of the string
12/1/2005 11:27:33 AM
yeah I was trying to avoid substrings but I think I've got it both ways now. thanks
12/1/2005 11:45:55 AM