【发布时间】:2014-12-01 16:10:51
【问题描述】:
我在 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)”应该出现在之后 只 em> 前两个“:”
请帮我解决这个问题。提前谢谢你。
【问题讨论】:
-
我很困惑 - 你希望 (zsep) 出现在哪里?
-
在
": "的前两次出现之后
标签: javascript regex string text-manipulation