Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18958
| Received | by 10.66.84.5 with SMTP id u5mr409096pay.11.1348691562773; Wed, 26 Sep 2012 13:32:42 -0700 (PDT) |
|---|---|
| Received | by 10.68.219.198 with SMTP id pq6mr818272pbc.0.1348691562756; Wed, 26 Sep 2012 13:32:42 -0700 (PDT) |
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!newsfeed.news.ucla.edu!usenet.stanford.edu!kq19no328416pbb.0!news-out.google.com!a8ni23357354pbd.1!nntp.google.com!4no12646069pbn.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.programmer |
| Date | Wed, 26 Sep 2012 13:32:42 -0700 (PDT) |
| In-Reply-To | <u0b668hvravflnt1upsks1rv0bnsmlt6us@4ax.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T |
| NNTP-Posting-Host | 69.28.149.29 |
| References | <7ku568loa4ogik4e6asouundcbcjurg6lj@4ax.com> <k3v3ic$9j4$1@dont-email.me> <u0b668hvravflnt1upsks1rv0bnsmlt6us@4ax.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <ee3feb2a-b390-4828-a2a2-fb5be29c5856@googlegroups.com> (permalink) |
| Subject | Re: Regexp exception in String.replaceAll |
| From | Lew <lewbloch@gmail.com> |
| Injection-Date | Wed, 26 Sep 2012 20:32:42 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.java.programmer:18958 |
Show key headers only | View raw
Tim Slattery wrote: > Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> wrote: >>Read the Javadoc carefully: > > Yes, I had completely missed that. I thought it was a literal > replacement string. > > In JSE4 [sic] and 5 the "replace" method took arguments of type "char". Now Still does in Java 6 and 7. http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(char, char) http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#replace(char, char) > I see that in JSE6 those arguments are CharSequence, an interface Same as in Java 5. http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#replace(java.lang.CharSequence, java.lang.CharSequence) > which String implements. So before JSE6, if you needed String > arguments, you had a choice of ReplaceAll [sic] or ReplaceFirst [sic]. Since I The behavior of 'String#replaceAll()' has not changed. It always took regexes. http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#replaceAll(java.lang.String, java.lang.String) > needed to allow for multiple occurrences of the replace string, I had > to use ReplaceAll [sic], and I missed this trap. (And I never considered It hasn't changed, ever. > that anybody would use a dollar sign in a filename!). Now that we're Really? It's quite routine, and Java programmers should find it especially common. > using JSE6, I can just change it to call replace instead of > replaceAll. Since those methods work *exactly* the same as in Java 5, I'm not sure what you're telling us here. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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