Reputation: 1949
Below is an extract from my long text:
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
Now I would like to find any blocks starting with ÷
and ending with \n
, and replace ÷
by ÷<font color="blue">
and \n
by </font>\n
. So, for example, my above extract would appear like this:
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
So far I have been using these Grep in TextWrangler to look for and replace:
(÷[^ \t/<>]*?).*?([^ \t/<>]*?\\n)
<font color="blue">\1\2</font>\3
The required blocks of text are successfully found, but replacing doesn't work as I expect.
I'm using TextWrangler, but may have access to BBEdit or Notepad++.
Can you please help me to solve this problem? Thank you very much.
UPDATE
Thanks to DesertEagle, I have worked out the solution. Here is the code:
÷([^\\n]+)\\n
÷<font color="blue">\1</font>\\n
Upvotes: 0
Views: 303
Reputation: 599
Though I don't have textwrangler at hand, this should work for you [1]
search
/÷([^\n]+)\n/
EDIT
The correct syntax for textwrangler is
÷([^\\n]+)\\n
replace
÷<font color="blue">\1</font>\n
[1] please ensure proper escaping for your engine
Upvotes: 1