I suspect $line only holds one line, so that what's preventing the regexp you presented from working.
Someone recently asked a similar question. You can check out our answers in this thread.
In reply to Re: search for blank lines by RegEx
by ikegami
in thread search for blank lines by RegEx
by mosh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |