Reputation: 1949
My text is as below:
• heading 1\n» text_string: text_string\n» text_string: text_string\n• heading 2\n» text_string: text_string\n» text_string: text_string
I want to change \n» text_string:
into \n» text_string\n -
so the text should be displayed in my app as:
• heading 1
» text_string
- text_string
» text_string
- text_string
• heading 2
» text_string
- text_string
...
How can I use RegEx (Grep) to find \n» text_string:
and replace it by \n» text_string\n -
?
(I'm using TextWrangler).
Thank you very much.
Upvotes: 0
Views: 141
Reputation: 581
if you want to change this:
• heading 1
» text_string: text_string
» text_string: text_string
• heading 2
» text_string: text_string
» text_string: text_string
to this:
• heading 1
» text_string
- text_string
» text_string
- text_string
• heading 2
» text_string
- text_string
» text_string
- text_string
I rather that you do something like this
text.replace(/:\stext_string(\n|$)/ig,"\n\t- text_string\n");
that is a normal regexp in javascript, I hope that help you somehow
Upvotes: 1