Js replace replaces all matched strings

  • 2020-03-30 01:46:08
  • OfStack

 
var s="abachdas"; 
var s2=s.replace(new RegExp(/(a)/),'b');//Replace all the a's in s with b's

Related articles: