下面是我的長文的摘錄替換它們:如何找到的文本,並使用正則表達式
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