in reply to meta parsing problems

This needs to match ANY meta tag in the format shown in the script, and yes I know I shouldn't do it this way but that's the question isn't on using a different module, it's how to fix this problem. Problem is, meta tags aren't always on the same line, they can all be bunched together like a paragraph and that's where this must be messing up.
You don't want to hear about using a module, but then you complain about having to solve precisely the nontrivial problem that the module is designed to solve. "I'm having trouble mowing my lawn with these scissors. I don't want to use my lawnmower, so don't suggest that. How can I make these scissors work better?"

You can either use the module and be done with a robust solution in ten minutes, or spend hours re-implementing the module and have a weak, brittle solution. Your choice.