下面是我的长文的摘录替换它们:如何找到的文本,并使用正则表达式
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 ++。
你能帮我解决这个问题吗?非常感谢你。
UPDATE
感谢DesertEagle,我已经制定了解决方案。下面是代码:
÷([^\\n]+)\\n
÷<font color="blue">\1</font>\\n
如何更换操作?你可以发布搜索结果并替换吗? – 2012-08-15 15:50:11