finding '\n'

Having trouble installing Oxygen? Got a bug to report? Post it all here.
nihilo
Posts: 31
Joined: Wed Jun 04, 2003 2:24 am

finding '\n'

Post by nihilo »

I am trying match on end of line characters using regex \n, but the search finishes without finding any, even though my file is 50 lines long. This is in latest standalone oxygen, on linux. Any ideas what is going on?
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Post by Dan »

For performance reasons the find is done iterating one line at the time. The pattern is matched always against a single line.

To support newlines in the pattern we would have to read the entire document into the REGEXP engine. This increase the memory consumption, and this is not an option. We will try to find a solution.
jmakeig
Posts: 10
Joined: Thu Jan 29, 2004 9:32 pm
Contact:

Finding blank lines

Post by jmakeig »

If it searches line by line, how do I find and delete blank lines?
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Post by Dan »

The replacement is done within one line at a time. If the line is empty, the result of the replacement is also empty, but the line will not be erased.

I recommend to use the "Format and Indent" action from the toolbar. It removes the empty lines.
catterall
Posts: 63
Joined: Sat Jan 24, 2004 12:10 am
Location: Oaxaca, Mexico
Contact:

Post by catterall »

At present you have to drop out of Oxygen and use something like BBedit on Mac or Windows, or awk/gawk on unix. Tedious, but it works.

The memory solution in Oxygen would be a sliding window, possibly configurable to a max. number of end-of-lines in a window. Tedius and probably slow, as window overap would be required - slide the window on one line at a time. Surely someone has already coded this, in Perl at least.

Ron
Post Reply