其中":56px"是未知的,我結(jié)果希望replace之后是這樣的height:12px;background:#fff;,下面是我寫的,會(huì)把width后面的全部刪掉的varstr="height:12px;width:56px;background:#fff;";str.replace(RegExp('width.*;'),'');//=>height:12px;
如何匹配"height:12px;width:56px;background:#fff;"中間的"width:56px;"?
慕的地6264312
2019-03-30 11:32:33