heres an interesting way of doing var x = mystring.length; for(x; x > 0; x--) { var s = mystring[x]; // if this character is an instance of the character you want to replace if(mystring.match(/[]/) // replace it mystring.replace(/[]/, "replacement"); }
On Thu, Oct 1, 2009 at 11:23 PM, waseem sabjee <waseemsab...@gmail.com>wrote: > well heres my method > use match to get the ammount of occurences of the instance. > for loop str.replace and replace each instance. > > > On Thu, Oct 1, 2009 at 10:46 PM, Brett Ritter <swift...@swiftone.org>wrote: > >> >> On Thu, Oct 1, 2009 at 1:18 PM, Junhua Gao <gaojun...@gmail.com> wrote: >> > I use $.SortSerialize('MDEExportedList').hash.replace('[]','') >> > but only the first one is replaced. >> >> I thought replace() only replaced the first instance unless a regex >> with global flag was used. >> >> -- >> Brett Ritter / SwiftOne >> swift...@swiftone.org >> > >