In the principle you can’t. Kate sees the document as a list of lines, and so far search and replace is done in one line at the time.
You can find line beginnings using a regular expression “^” or “$”.
Using Kate, you can use the textfilter plugin with perl or sed to achieve this. A sample textfilter script which replaces more blank lines with one single newline could look like this (split into more lines for readability):
perl -e ‘while (<>) { if (/^\s*$/) { $blank++; } else { if ($blank) { print “\n”; undef $blank; } print; } }’
If you do this often, you could save the perl code to a script somewhere in your PATH. And you could write a script taking parameters to be able to specify search and replace patterns.
If you use KWrite or other KatePart clients, you could easily write a javascript that works just like the above example, see the javascript documentation