in reply to Return multiple matches in file

The interesting thing with this old code is: it should work, i.e. it should find more than one occurence, but it doesn't. Somehow //g doesn't work when a variable is inserted into the regex, even though that variable isn't changed

Anybody have a explanation for that?