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.
好的,我正在尝试为翻译脚本设置一组标签列表,但遇到了一个问题,我需要使用正则表达式删除其中一种语言中的空格
线条的设置就像"JP JP":"ENG ENG"我希望它是"JPJP":"ENG ENG"
"JP JP":"ENG ENG"
"JPJP":"ENG ENG"
我是正则表达式的新手,所以我不知道该尝试什么
谢谢!
试试这个,这个表达式使用正向前瞻
\s+(?=\w+":")
您可以使用Unix实用程序sed
Unix
sed
sed -i 's/old_name/new_name/g' your-file
在您的示例中,这应该是:
sed -i 's/"JP JP":"ENG ENG"/"JPJP":"ENGENG"/g' your-file