File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes java 6 replacell/repalcefirst Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

java 6 replacell/repalcefirst

joe nesbitt

Joined: Dec 05, 2009
Posts: 17
Hi all,

The following regex works when used in string.replaceall() but not in case of string.replaceFirst().


Expected output:


Output (not desired):

No changes are made to the string, not sure why.

Please help!

Thanks in advance.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Please UseOneThreadPerQuestion. This is your third thread about this question.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
Wouter Oet wrote: . . . This is your third thread about this question.
In which case this thread si closed. Thank you fo noticing, Wouter.
I agree. Here's the link:
subject: java 6 replacell/repalcefirst
It's not a secret anymore!