What the . . . oh, I had
. Convenient when I type it by itself, but too late for
by the end of it; I so rarely use the command that I didn't notice I'd restricted myself that way. Sorry for the added confusion.
(I replaced it with a function that only adds those arguments if I didn't supply any already.)
I still think from Ray's mention of "words" that he was reading documentation about history expansion rather than pattern-matching.
So, OK, -m option restricts the list of history entries printed out to those matching the pattern. The argument is a glob pattern of the sort used to match files, not a regular _expression_. Even if it were a regular _expression_, though, ^ and $ would still match everything, since every string has a beginning and an end. So I'm not clear what your goal was.
If you have extendedglob turned on, then ^ is negation; ^foo matches anything that doesn't match foo, so ^ again matches everything. If you don't have extendedglob turned on, it's not special at all, and ^ looks for an entry exactly equal to nothing but "^". And $ is not special either way, so that is again looking for an entry consisting of nothing but a single dollar sign, and not surprisingly failing to find one.