I am editing a .txt file under Windows XP Pro. I have blank lines in my file (0D.0A in the hex dump, as I would expect). A search for ^$ wirh regular expressions enabled does not find the blank line. Searches including \n or \r do not return results anywhere in the file. A search for ^.*$ will find any non-blank line.
Why isn't my search on ^$ finding the blank line?
Searching for blank line in .txt file with ^$
-
- Posts: 3
- Joined: Wed Apr 19, 2006 1:15 am
Hi Brad,

I suspect this bug will be a fairly easy to fix so with any luck, expect to see a new Zeus patch in the the next week or two
In the mean time, the only other solution I can suggest is using a Zeus macro to do the search. As an example of what I mean, here is a quick and dirty macro that finds the next blank line in the current document.
Thank you for taking the time to posting this bug report 
Cheers Jussi
Unfortunately it looks like you have found a bug with the Zeus searching engineA search for ^$ with regular expressions enabled does not find the blank line.

I suspect this bug will be a fairly easy to fix so with any luck, expect to see a new Zeus patch in the the next week or two

Currently there is no way to search for the \n or \r characters. This is a known limitation of the Zeus search engineSearches including \n or \r do not return results anywhere in the file

In the mean time, the only other solution I can suggest is using a Zeus macro to do the search. As an example of what I mean, here is a quick and dirty macro that finds the next blank line in the current document.
Code: Select all
function key_macro()
-- macro only works for documents
local document = is_document()
if (document == 0) then
-- can't run astyle.exe on current document
message("This macro can only be run with an open document.")
beep()
return
end
local line_current = get_line_pos()
-- get the length of the current line
local len = string.len(get_line_text(line_current))
if len == 0 then
-- check if the file was found last time
local line_last = get_global_string("LineSearch")
if (line_last ~= nil) then
if (line_current == tonumber(line_last)) then
line_current = line_current + 1
end
end
end
local line_total = get_line_count()
-- search the current file for the empty lines
while line_current < line_total do
-- get the length of the current line
local len = string.len(get_line_text(line_current))
if len == 0 then
-- place the cursor on the empty line
set_line_pos(line_current, 0)
-- save the last line found to the global variable
set_global_string("LineSearch", line_current)
message("Found an empty line.")
return
end
-- next line
line_current = line_current + 1
end
-- reset the global variable
set_global_string("LineSearch", "")
message("No empty line found.")
end
key_macro() -- run the macro

Cheers Jussi
-
- Posts: 3
- Joined: Wed Apr 19, 2006 1:15 am
Searching for blank line in .txt file with ^$
Thanks, Jussi. I'll keep a sharp eye out for the patch.
The latest Zeus patch found here:Why isn't my search on ^$ finding the blank line?
http://www.zeusedit.com/forum/viewtopic.php?t=533
can now search for the ^$ regular expression.
Cheers Jussi
-
- Posts: 3
- Joined: Wed Apr 19, 2006 1:15 am
Thanks!
Thanks for taking care of this, Jussij.
Best regards,
Brad
Best regards,
Brad