Find/Replace in Files

Having trouble installing Oxygen? Got a bug to report? Post it all here.
sbodoff
Posts: 20
Joined: Tue Jun 14, 2011 10:42 pm

Find/Replace in Files

Post by sbodoff »

Is there any way to specify a newline in the "Replace with" field in the Find/Replace in Files dialog? I'm looking for the equivalent to the "Insert Newline" option that is available in the Find/Replace dialog.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Find/Replace in Files

Post by adrian »

Hi,

You can enable Regular Expression and use in the Replace with field '\n' (without the quotes).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
arhebis
Posts: 16
Joined: Sat Nov 03, 2012 8:45 pm

Re: Find/Replace in Files

Post by arhebis »

\n is not working for "find in files" with Regular Expressions.

Do you have an idea why?

Thanks,
Gabriela
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Find/Replace in Files

Post by adrian »

Hi,

What version of Oxygen are you running (Help > About)?

Are you using '\n' in mid expression to search content that spans over two or more lines?
e.g. a\nb which translates to:

Code: Select all

a
b
Please note that the "Find/Replace in Files" tool from v13.2 and earlier searches one line at a time, so this type of expression will not work. You can only search up to and including the \n character on each line. e.g. a\n

Starting with v14.0 the "Find/Replace in Files" tool has been improved to search for content that spans across multiple lines. That means that searching for a\nb works now.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
arhebis
Posts: 16
Joined: Sat Nov 03, 2012 8:45 pm

Re: Find/Replace in Files

Post by arhebis »

I'm using 13.0. So I'll probably have to upgrade then.

Thanks,
Gabriela
tcg71
Posts: 1
Joined: Tue Apr 08, 2014 3:57 pm

Re: Find/Replace in Files

Post by tcg71 »

Hi,

I'm using Oxygen 15.2, but have the same problem. Using \n in serach expression doesn't find any match, but using \s+ it will accept whitespaces and newlines. Why is \n not working ?

Same expression works when searching in within one file.

Thomas
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Find/Replace in Files

Post by adrian »

Hi,

Are you searching just for '\n' or are you using '\n' in a larger expression?
In what type of files are you searching this?
Are there any other options (other than 'Regular expression') enabled in the Find/Replace in Files dialog?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply