commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nacho G. Mac Dowell" <igonza...@informa.es>
Subject Re: [Chain] adding EL support
Date Mon, 13 Jun 2005 07:31:20 GMT

> (b) which doesn't work when the replacement value has a "$" in it -- a 
> bug I just hit today but haven't had a chance to fix.

You need to escape the $ sign since it is used for group references. 
Try: "FOOBAR".replaceAll("FOO", "\\$");

Quoting java.util.regex.Matcher#appendReplacement(StringBuffer, String):

"Note that backslashes (\) and dollar signs ($) in the replacement 
string may cause the results to be different than if it were being 
treated as a literal replacement string. Dollar signs may be treated as 
references to captured subsequences as described above, and backslashes 
are used to escape literal characters in the replacement
string."

best regards,

nacho

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message