Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18963

Re: Regexp exception in String.replaceAll

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Regexp exception in String.replaceAll
Date 2012-09-27 12:10 -0700
Organization Canadian Mind Products
Message-ID <3v89681ugms051o2kr4n040ehj6rkkq16l@4ax.com> (permalink)
References <7ku568loa4ogik4e6asouundcbcjurg6lj@4ax.com>

Show all headers | View raw


On Wed, 26 Sep 2012 08:57:53 -0400, Tim Slattery <Slattery_T@bls.gov>
wrote, quoted or indirectly quoted someone who said :

>String result = upload.replaceAll("\\{FileName\\}", fileName);

In the Javadoc for replaceAll  is warns you:
 Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
the replacement string may cause the results to be different than if
it were  being treated as a literal replacement string; see
     {@link java.util.regex.Matcher#replaceAll Matcher.replaceAll}.
     Use {@link java.util.regex.Matcher#quoteReplacement} to suppress
the special meaning of these characters, if desired.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The iPhone 5 is a low end Rolex. 

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Regexp exception in String.replaceAll Tim Slattery <Slattery_T@bls.gov> - 2012-09-26 08:57 -0400
  Re: Regexp exception in String.replaceAll Arne Vajhøj <arne@vajhoej.dk> - 2012-09-26 09:13 -0400
  Re: Regexp exception in String.replaceAll Steven Simpson <ss@domain.invalid> - 2012-09-26 15:18 +0100
  Re: Regexp exception in String.replaceAll Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-09-26 16:30 +0200
    Re: Regexp exception in String.replaceAll Tim Slattery <Slattery_T@bls.gov> - 2012-09-26 12:35 -0400
      Re: Regexp exception in String.replaceAll markspace <-@.> - 2012-09-26 10:00 -0700
        Re: Regexp exception in String.replaceAll Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-09-26 21:26 +0200
          Re: Regexp exception in String.replaceAll Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-26 13:27 -0700
            Re: Regexp exception in String.replaceAll markspace <-@.> - 2012-09-26 14:31 -0700
      Re: Regexp exception in String.replaceAll Lew <lewbloch@gmail.com> - 2012-09-26 13:32 -0700
  Re: Regexp exception in String.replaceAll Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-26 09:43 -0700
  Re: Regexp exception in String.replaceAll Roedy Green <see_website@mindprod.com.invalid> - 2012-09-27 12:10 -0700

csiph-web