Hi,
I want to replace mulitple occurances of a string one after the another
with a single string
for eg .
input : a hello b world c java abcabcabc
output: a hello b world c java def
I mean multiple occurances of pattern 'abc' with a single string 'def'.
how can do this with JAVA regular expressions ?
I tried replaceAll method in string class, but I dont know how to
format regular expression.
thanks
Ranu
Flávio Barata - 31 Jul 2006 12:57 GMT
Hi,
Try this piece of code:
"a hello b world c java abcabcabc".replaceAll("(abc)+", "def")
flavio
> Hi,
>
[quoted text clipped - 15 lines]
> thanks
> Ranu