Bug in multi-file find & replace?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Joe Wicentowski
Posts: 1
Joined: Wed Dec 26, 2007 10:55 pm

Bug in multi-file find & replace?

Post by Joe Wicentowski »

I'm observing some differences in the single- and multi- file find & replace. I'm trying to find instances of:

<note>...</note>
<note>...</note>

and collapse the notes together - thus:

<note>... ...</note>

To do so, I am searching for:

</note>\s*<note>

and replacing this string with a single space. This works fine in single-file find and replace, but not in multi-file find and replace. Any suggestions? I'm using oXygen 9.1 on WinXP.

Thanks!
Joe
Radu
Posts: 9469
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Dear Joe,

Thank you for contacting us.
The Find Replace in Files dialog does not apply the regular expression on multiple lines so a regular expression which spans multiple lines like yours is not correctly found or replaced.
When performing find/replace in an opened editor multi-line regular expression matching is correctly supported.
I'll file an enhancement request to our internal bugs list so that multi-line regular expressions are supported also when find/replace in files is performed.

In the meantime you can also apply XSLT transforms to obtain similar results.
For a sample XML like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<root>
<note>1</note>
<note>2</note>
<note>3</note>
<note>4</note>
</root>
applying the XSL:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="root">
<root>
<xsl:if test="count(note) > 0">
<note>
<xsl:for-each select="note">
<xsl:value-of select="text()"/>
</xsl:for-each>
</note>
</xsl:if>
</root>
</xsl:template>
</xsl:stylesheet>
would merge all note tags into one.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply