How to search using wildcard in VIM
I think you're misunderstanding how the wildcard works. It does not match 0 or more characters, it matches 0 or more of the preceding atom, which in this case is y
. So searching
/array*=
will match any of these:
arra=
array=
arrayyyyyyyy=
If you want to match 0 or more of any character, use the 'dot' atom, which will match any character other than a newline.
/array.*=
If you want something more robust, I would recommend:
/array\s*\[[^\]]\+\]\s*=
which is "array" followed by 0 or more whitespace, followed by anything contained in brackets, followed by 0 or more whitespace, followed by an "equals" sign.