Consider this small test file:
var b = "hi";
A search for ^\w+ finds TWO results: var and b.
I've isolated the problem to this line of code: https://github.com/ajaxorg/ace/blob/master/lib/ace/search.js#L140
It seems that the startIndex--in this case, anyway--is 4, which chops the var string off, which makes the match think that b is the beginning of a line.
merging into #2059