Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一串像5:11,14:00,17:11,22:00.
5:11,14:00,17:11,22:00
我需要用分号替换所有其他逗号以获得5:11,14:00;17:11,22:00 .
5:11,14:00;17:11,22:00
正则表达式是什么?
这应该这样做:
var times = '5:11,14:00,17:11,22:00'; times.replace(/(,[^,]*),/g, '$1;');