'2017-6-5'.replace(/-(\d{1})$|-/g,'0'),返回为什么是20170605,少了"-",我要的结果是2017-06-05
闭关修行中......
'2017-6-5'.replace(/-(d{1})/g,'-0$1') Try writing it like this.
'2017-6-5'.replace(/-(d{1})/g,'-0$1')
'2017-6-5'.replace(/-(d{1})/g,'-0$1')
Try writing it like this.