• Post Reply Bookmark Topic Watch Topic
  • New Topic

java regular expression problem  RSS feed

 
ranu mehta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to replace mulitple occurances of a string one after the another with a single string

for eg .

input string : a hello b world c java abcabcabc

the output string I want is :

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
 
Henry Wong
author
Sheriff
Posts: 23289
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try...



Henry
 
ranu mehta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks .. it worked
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!