I am happy with Mozilla do if all browsers do that way..

Alternately, I will be also happy to take, if

"Foo Bar foo bar foo bar".replace("bar", "---");

gives ==>
"Foo --- foo --- foo ---"

ie, the replace is global and case insensitive.
practically most time that is what web developer want.
and many old languages use to do that way.

Cheers
Biju


On 6 March 2012 04:31, gaz Heyes <[email protected]> wrote:
> On 6 March 2012 05:35, Biju <[email protected]> wrote:
>>
>> So I have proposal, can we have 3rd parameter for replace() function?
>> like
>>
>> haystack.replace(needle, newText, regexpFlag);
>>
>> where regexpFlag is the flag part of the RegExp.
>> And if "needle" is a string will be used to make the match characters
>> after "escaping" special characters like *?.()[]{}\^$|/
>
>
> No no no no nooooooooooooooooo. This is already one of the best functions in
> JavaScript but has been really badly designed. This suggestion makes it
> worse.
>
> <http://www.thespanner.co.uk/2010/09/27/string-replace-javascript-bad-design/>
>
> Even Twitter devs seemed to struggle with using it correctly to fix a DOM
> xss issue.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to