I've got a file with 909-lines, 358 of which are blank. To my surprise, count-matches, given a patten of ^$ says there are 10 matches. It turns out those are the number of *runs* of blank lines (including 1 at the end). isearch-forward-regexp given ^$ treats the blank lines separately, as expected. In GNU Emacs 25.2.1 (x86_64-unknown-cygwin)  of 2017-04-21 built on moufang Windowing system distributor 'Microsoft Corp.', version 6.1.7601 Configured using:  'configure  --srcdir=/home/kbrown/src/cygemacs/emacs-25.2-1.x86_64/src/emacs-25.2  --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc  --docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C  --with-w32 'CFLAGS=-ggdb -O2 -pipe -Wimplicit-function-declaration  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-25.2-1.x86_64/build=/usr/src/debug/emacs-25.2-1  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-25.2-1.x86_64/src/emacs-25.2=/usr/src/debug/emacs-25.2-1'  CPPFLAGS= LDFLAGS=' Configured features: XPM JPEG TIFF GIF PNG IMAGEMAGICK SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS Important settings:   value of $LANG: en_US.UTF-8   locale-coding-system: utf-8-unix Major mode: Help Minor modes in effect:   display-time-mode: t   show-paren-mode: t   tooltip-mode: t   global-eldoc-mode: t   electric-indent-mode: t   mouse-wheel-mode: t   file-name-shadow-mode: t   global-font-lock-mode: t   font-lock-mode: t   blink-cursor-mode: t   auto-composition-mode: t   auto-encryption-mode: t   auto-compression-mode: t   buffer-read-only: t   line-number-mode: t   transient-mark-mode: t Recent messages: Eager macro-expansion failure: (void-variable height) For information about GNU Emacs and the GNU system, type C-h C-a. Mark saved where search started [6 times] Mark set [2 times] 10 occurrences Mark set Mark saved where search started Quit No library isearch.el in search path Type C-x 1 to delete the help window. Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils eieio-opt speedbar sb-image ezimage dframe find-func thingatpt misearch multi-isearch browse-url url-util url-parse auth-source cl-seq eieio byte-opt bytecomp byte-compile cl-extra cconv eieio-core cl-macs gv gnus-util mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr password-cache url-vars avoid time paren cus-start cus-load time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind gfilenotify w32 multi-tty make-network-process emacs) Memory information: ((conses 16 113245 5836)  (symbols 48 22653 0)  (miscs 40 78 243)  (strings 32 23854 5007)  (string-bytes 1 639594)  (vectors 16 14638)  (vector-slots 8 455632 4033)  (floats 8 218 82)  (intervals 56 240 0)  (buffers 976 19))