正则匹配多行任意字符 ([wW]*) 例子: const str= ` pages: [ 'a', 'b', 'c' ], windows: { } ` str.replace(/([wW]*)/,'any') 参考:https://www.jianshu.com/p/ff05d467e145