我有一个方括号之间的数字列表,我需要在确切数字之前和之后添加单词(即保持相同的数字)。我用notepad++来代替,但如果你有其他程序的解决方案,请指教。
示例:
text [121] othertext
moretext [16] othertextmore
andtext [5940] othertextplus
结果:
text xxxxxxxxx [121] xxxxxxxxx othertext
moretext xxxxxxxxx [16] xxxxxxxxx othertextmore
andtext xxxxxxxxx [5940] xxxxxxxxx othertextplus
数字当然是
\d+
但我想告诉它在查看时保持相同的数字。
最佳答案
查找内容:(\[\d+])
替换为:xxxxxxxxx \1 xxxxxxxxx
关于regex - 在数字前后添加字符的正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8624018/