This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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: 43381
Wouter Oet wrote: . . . This is your third thread about this question.
In which case this thread si closed. Thank you fo noticing, Wouter.
Consider Paul's rocket mass heater.
subject: java 6 replacell/repalcefirst
It's not a secret anymore!