I'm trying to turn, a/b/c.x.y
into abc
. However there seems to be an issue with my regular expression, specifically with '\\.*'
.
"a/b/c.x".replaceAll( "/|\\.*", "" );
yields:
"abcx"
Any insight would be great, thanks!
You're replacing any slash or "any number of dots" with an empty string.
I suspect you mean any slash or "a dot followed by any number of any characters" which would be:
replaceAll("/|\\..*", "");
That certainly works for me with the sample value.