in reply to Resize video for mobile browser

I note you are matching against attribute="value" throughout and matching a single space between attribute/value pairs. The source HTML could easily contain additional whitespace such as attribute = "value".

If you're going to do the matching yourself (rather than using one of the tools like those shown above), you need to take this into consideration.

-- Ken