A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
java 6 replacell/repalcefirst
Joined: Dec 05, 2009
Sep 26, 2010 10:48:27
The following regex works when used in string.replaceall() but not in case of string.replaceFirst().
string.replaceAll( "(TEST\\|[\\|\\|]*\\\\|)\\|\\|", "$1|ST|" );
Output (not desired):
string.replaceFirst( "(TEST\\|[\\|\\|]*\\\\|)\\|\\|", "$1|ST|" );
No changes are made to the string, not sure why.
Thanks in advance.
Joined: Oct 25, 2008
Sep 26, 2010 11:06:36
. 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.
Joined: Oct 13, 2005
Sep 27, 2010 03:41:14
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
Short-Circuit Logical Operators
x++ , ++x
explain this ...please
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014