Other than the typo (missing less-than symbol), I think you just need the g modifier on the regex, so it will do more than the first occurance on the line.
If the array holds things other than letters (e.g. '*'), you will need to escape them out! Other than that, it looks like it should work.
—John
Comment on Re: Match text in file with array and substitute array position ?