以下是我长文的摘录:
As a young researcher, he is required:
\n ÷ to read at least three theses\n ÷ to meet his tutor or supervisor
once a week\n ÷ to join seminars\n
现在我想找到任何以 开头÷
和结尾的块,\n
并替换÷
为÷<font color="blue">
和\n
。</font>\n
因此,例如,我上面的摘录将如下所示:
As a young researcher, he is required:
\n ÷<font color="blue"> to read at least three theses</font>\n ÷<font color="blue">
to meet his tutor or supervisor once a week</font>\n ÷<font color="blue"> to join seminars</font>\n
到目前为止,我一直在 TextWrangler 中使用这些 Grep 来查找和替换:
(÷[^ \t/<>]*?).*?([^ \t/<>]*?\\n)
<font color="blue">\1\2</font>\3
已成功找到所需的文本块,但替换不像我预期的那样工作。
我正在使用 TextWrangler,但可以访问 BBEdit 或 Notepad++。
你能帮我解决这个问题吗?非常感谢你。
更新
感谢 DesertEagle,我已经找到了解决方案。这是代码:
÷([^\\n]+)\\n
÷<font color="blue">\1</font>\\n