目标是做出类似的东西
This is some text=This is some text
成为:
This\ is\ some\ text=This is some text
我一直在玩各种不同的东西,我知道会在 (?==) 前面抓取空格/空白(例如“\”或\s),这似乎会选择直到 = 字符,但似乎没有什么使用 Intellij IDEA 的搜索和替换。
有什么建议吗?
最佳答案
复制评论中的答案,以便从“未回答”过滤器中删除此问题:
This -
(\s)(?=.*=)
should work. Replace it with\$1
~ 回答 Rohit Jain
OP 还证实了这一点:
That worked, though I used a literal space instead of the \s because it was picking up some additional white space I didn't want replaced. Also had to do some silly escaping for the replace (\\$1 )
关于正则表达式——替换特定字符之前的所有空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19305054/