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


Groups > comp.lang.javascript > #12069

Re: Replace all strings

From "J.R." <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Replace all strings
Date 2012-02-22 20:27 -0200
Organization Aioe.org NNTP Server
Message-ID <ji3q58$nr6$1@speranza.aioe.org> (permalink)
References <f65a4c81-b021-4254-b8d3-725858e39f32@vh10g2000pbc.googlegroups.com> <ji3d9u$l9r$1@speranza.aioe.org> <0794f674-e437-4d95-87b3-f1580418f1fb@sk8g2000pbc.googlegroups.com>

Show all headers | View raw


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.

Hi,
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).

Cheers,
Joao Rodrigues (J.R.)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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