wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

java 6 replacell/repalcefirst

joe nesbitt
Greenhorn

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

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

String:



Expected output:




Regex:



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
Sheriff

Joined: Oct 13, 2005
Posts: 38062
    
  22
Wouter Oet wrote: . . . This is your third thread about this question.
In which case this thread si closed. Thank you fo noticing, Wouter.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java 6 replacell/repalcefirst
 
Similar Threads
Reference Casting
Short-Circuit Logical Operators
explain this ...please
java regex
x++ , ++x