Page 1 of 1

Surround every line in text with particular tag

Posted: Fri Oct 15, 2010 12:50 pm
by augustix
How can I surround every line in selected text with particular tag? Is it possible in Oxygen XML editor? For example, I have following text lines:

So I crawl back into your open arms
Yes I crawl back into your open arms
And I crawl back into your open arms
Yes I crawl back into your open arms

And I want to encoding them with tag <line> on following way:

<line>So I crawl back into your open arms</line>
<line>Yes I crawl back into your open arms</line>
<line>And I crawl back into your open arms</line>
<line>Yes I crawl back into your open arms</line>

How can do this without encoding separatly every line? I want to select the complete text and do command "surround with tag <line> every line in text". Is it possible?

Thank for any answer!

Re: Surround every line in text with particular tag

Posted: Fri Oct 15, 2010 2:18 pm
by adrian
Hello,

You can do this in Oxygen from the Find/Replace dialog(CTRL+F).

This is a find/replace regular expression solution.
In the editor select the lines of text you want to process, invoke the Find/Replace dialog(CTRL+F) and switch the Scope to Only selected lines.

In the "Text to find" field enter:

Code: Select all

^.+$
In "Replace with" enter:

Code: Select all

<line>$0</line>
In the Options section enable Regular expression and disable "Dot matches all".
Press "Replace all" and each of the non-empty selected lines will be replaced with its old contents surrounded by the line tag.

Regards,
Adrian

Re: Surround every line in text with particular tag

Posted: Fri Oct 15, 2010 6:36 pm
by augustix
Thanks Adrian! It's working!