我有這個字符串在Javascript:插入串在另一個字符串匹配
text = "2222 22:22: John: New York /n last year and: the next year /n 3333 33:33: Jack: Los Angeles!!!"
我希望它是以下幾點:
newText = "(xSep)2222 22:22:(zSep) John:(zSep) New York /n last year and: the next year /n (xSep)3333 33:33:(zSep) Jack:(zSep) Los Angeles!!!"
我試過很多東西只有這樣,我的代碼才能工作。 因此,一個「(xSep)」應該來每四個數字以前和「(zSep)」應後只前兩個來了「:」
請幫助我。先進的謝謝你。
我很困惑 - 正是你想要的(zsep)出現? – ekrah 2014-12-01 16:17:53
只有前兩次出現':「' – Nano 2014-12-01 16:21:35