How to detect iOS 6 and all minor versions by user agent with a simple regex or something? Would be nice to distinct between iphone and ipad as well.
This question differs from What is the iOS 6 user agent string? since I wanted help in building a regex based on the information I already know (which can be found in the linked question)
CHANGELOG
PREREQUISITES
REGEX
SUPPORTED DEVICES LIST
EXPLANATION / CUSTOMIZATION
Lines preceded by a C can be customized.
line 1. UA strings may differ so this line is introduced for accepting UA strings as much as possible.
line 2. You can specify here the piped-separated list of accepted devices.
(...)
line 7. The version is indicated here. Change this line if you want a special version. Don't forget to update line 13 too. For instance, matching iOS 5.x.y use
(?:OS\s*5_\d+_\d+\s*)?
.line 8. Some user agent strings are translated. The word
like
may be translated into a foreign language. The regexp now supportsEnglish
andFrench
. Adapt this line if you encounter other languages. Don't forget to update line 12 too.(...)
line 12. See line 8.
line 13. See line 7. For instance, matching iOS 5.x.y use
(?:Version/5\.\d+\.\d+)?\s*)?
.