UA patterns don't match example UAs
eeeps opened this issue · 3 comments
I tried to convert the patterns in the UA strings section into regexes. Here's what I came up with:
https://gist.github.com/eeeps/79d02d311b8c1a1c64487f2be1c9c2ef
In order to match the spec's example UAs, I had to make the following modifications to the spec's patterns:
-
The Chrome and Safari patterns are both missing
(KHTML, like Gecko)
-
The Safari pattern needs, at the least, variable device information; the pattern does not match the Mobile example. I added two new capture groups and treated them like
<platform>
and<oscpu>
, not sure if this is correct. -
The numbers and dots after
Safari/
andAppleWebKit/
differ between the Mobile and Desktop examples. The pattern only matches the desktop example. -
Less significantly, the
;
afterMobile
should be highlighted as matched in the Firefox Mobile example.
Thanks @eeeps! Yeah, there's some bugs that need to be fixed. Appreciate the feedback.
(fyi: edited the issue description to turn each point of feedback into a checkbox so i can keep track)