Page 1 of 1

Find/replace newline

Posted: Thu Jun 15, 2017 2:46 am
by MelkorX
I am trying to remove extra spaces at the beginning and end of <codeblock> elements in DITA files. For example:

<codeblock>
codeExample ce = new codeExample();
ce.someFunction();
</codeblock>

should be

<codeblock>codeExample ce = new codeExample();
ce.someFunction();</codeblock>

I'm having trouble accomplishing this with the Find/Replace in Files dialog. Any tips?

Re: Find/replace newline

Posted: Thu Jun 15, 2017 9:33 am
by Radu
Hi,

With the "Regular Expressions" checkbox checked you can search for something like <codeblock>[\n\r\s]+ and replace with something like <codeblock>.
Our "Replace All" functionality allows you to preview the changes before applying them.

Regards,
Radu

Re: Find/replace newline

Posted: Thu Jun 22, 2017 11:55 pm
by MelkorX
Thanks Radu. I had to add \t as well to the regular expression, and then it worked.