Some minor performance-tweaks

I removed str_replace for regex (by using a custom delimiter) and added a lookup-cache for matchUAAgainstKey, which should speed up the mobileGrade-function.

Sorry for the changed spacing, but the should match the codestyle!