Avoid PHP errors if the RegEx doesn't match anything

Ran into a problem where if I provide an invalid User Agent which doesn't match the RegEx, it throws undefined index 0 errors. So just added a quick check to break out if it didn't match anything.
Merge pull request #9 from manavo/patch-1

Avoid PHP errors if the RegEx doesn't match anything.