Get Android OS version from user-agent

前端 未结 5 800
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-08 11:21

I\'ve been trying to find a parser or regex that will give me the Android OS version from a user agent string.

E.g.

Mozilla/5.0 (Linux; U; Android 2.         


        
5条回答
  •  甜味超标
    2020-12-08 12:08

    Motorola's player user agents can have the following:

    Linux;Android ; Release/4.1.2
    

    So, I've had to start using the the following:

    [a|A]ndroid[^\d]*([\d[_|.]]+\d)
    

提交回复
热议问题