Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12091
| Message-ID | <1938247.aqSPkdTlGX@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2012-02-23 14:36 +0100 |
| Subject | Re: Replace all strings |
| Newsgroups | comp.lang.javascript |
| References | <f65a4c81-b021-4254-b8d3-725858e39f32@vh10g2000pbc.googlegroups.com> <ji3d9u$l9r$1@speranza.aioe.org> <0794f674-e437-4d95-87b3-f1580418f1fb@sk8g2000pbc.googlegroups.com> <ji3q58$nr6$1@speranza.aioe.org> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
J.R. wrote:
> On 22/02/2012 17:29, Archos wrote:
>> On Feb 22, 6:48 pm, "J.R."<groups_j...@yahoo.com.br> wrote:
>>> On 22/02/2012 15:48, Archos wrote:
>>>> How to replace all strings at the same time?
>>>>>>> var a = "a,b,c,d";
>>>>>>> a.toString().replace(",", "")
>>>> "ab,c,d"
>>>
>>> If I understood correctly, you want to replace all the commas in a
>>> variable with '', right? Then you might use a RegExp such as:
>>>
>>> var a = "a,b,c,d";
>>> a.replace(/,/g, '')
>> Yes, thanks. I hope that the use of regular expressions been right for
>> main browsers.
>
> The "searchValue" argument of the String.prototype.replace method can be
> a regular expression or not, according to the standards (ECMA-262
> Editions 3 and 5, section 15.5.4.11).
More importantly, the RegExp initialiser (sic!) and constructor are
supported since at least JScript 5.5.6330 (IE 5.5), JavaScript 1.5
(NN6/Fx1), V8 3.6.6.19 (Cr16), JavaScriptCore 531.22.7 (Safari 4.0.5),
Opera ECMAScript 7.02, KDE JavaScript 4.6.5 (Konqueror 4.6.5).
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Replace all strings Archos <raul.san@sent.com> - 2012-02-22 09:48 -0800
Re: Replace all strings "J.R." <groups_jr-1@yahoo.com.br> - 2012-02-22 16:48 -0200
Re: Replace all strings Archos <raul.san@sent.com> - 2012-02-22 11:29 -0800
Re: Replace all strings "J.R." <groups_jr-1@yahoo.com.br> - 2012-02-22 20:27 -0200
Re: Replace all strings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 14:36 +0100
Re: Replace all strings Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-23 05:55 -0800
Re: Replace all strings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 15:12 +0100
Re: Replace all strings "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-22 22:02 +0000
Re: Replace all strings Gene Wirchenko <genew@ocis.net> - 2012-02-22 15:03 -0800
csiph-web