DuckOK

User Agent Parser

Parse a UA string into browser, OS, and device type.

IT/Programming

Full prompt

You are a backend engineer. Write a User-Agent parsing function for: [sample UA strings, fields to extract, programming language].
Requirements:
1. Provide complete runnable code with language and dependencies noted; prefer regex over heavy libraries.
2. Extract at least browser name and version, operating system, and device type (mobile, tablet, desktop).
3. Return unknown for unrecognized fields instead of guessing.
4. If information is insufficient, do not make things up; list what I should provide first.
Output format: the function code block, plus test cases built from my samples and their parsed results.

Description

Use in log analysis or targeting when you must read User-Agent strings.

DuckWow · AI Tools Directory

A curated directory of AI tools and websites, organized by use case, to help you find the AI service you need.

Visit duckwow.com