Surround every line in text with particular tag

Having trouble installing Oxygen? Got a bug to report? Post it all here.
augustix
Posts: 2
Joined: Fri Oct 15, 2010 12:34 pm

Surround every line in text with particular tag

Post 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!
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Surround every line in text with particular tag

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
augustix
Posts: 2
Joined: Fri Oct 15, 2010 12:34 pm

Re: Surround every line in text with particular tag

Post by augustix »

Thanks Adrian! It's working!
Post Reply