如果已经没有空格,我正在尝试在冒号和字符或数字之间添加一个空格:
this is my sentence:hi it's midnight
this is my sentence:2012 was a good year.
this sentence should be ignored: ignore me
我希望它阅读:
this is my sentence: hi it's midnight
this is my sentence: 2012 was a good year.
this sentence should be ignored: ignore me
我试过这个没有成功。 正则表达式在vim中插入空格
我可以使用它获得“:X”或“:0”(它与冒号后的空格不匹配,这很好):
:[^\s]
但如果我替换为:
: $0
它最终像:
this is my sentence: :hi it's midnight
this is my sentence: :2012 was a good year.
我正在使用http://www.gskinner.com/RegExr/来测试模式。
我将使用 PHP preg_replace 函数
任何帮助深表感谢。提前致谢。