Android携帯、タブレットをUser Agentで区別するRubyの正規表現 Andorid端末でも携帯とタブレットをUser Agent/ユーザーエージェントで区別するRubyの正規表現を考えてみた。Google ウェブマスター向け公式ブログ: Android のユーザーエージェントの検出についてによると、Android携帯はUser Agentに'Mobile'という文字を含んで、タブレットは含まないということ(※)なので、これに基づいた正規表現を考えてみる。 Android携帯/Android.*Mobile/ =~ request.env["HTTP_USER_AGENT"] Androidタブレット/(?!(Android.*Mobile)+)Android/=~ request.env["HTTP_USER_AGENT"] こんな感じで一応区別できているようだが、タブレット