問題タブ [rex]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
regex - HTTP リクエストから User-Agent を抽出する
HTTP リクエストから User-Agent 値を取得し、「UserAgent」という名前の別のフィールドに入れようとしていますが、これまでのところ成功していません。キャリッジリターンとラインフィードを調べる必要があるように見えますか? どんな助けにも感謝します。
以下はregex101リンクです。
https://regex101.com/r/rdu8yE/1
POST /xxx/yyyy HTTP/1.1\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0\r\nAccept: application/json\r\nAccept-言語: en-US,en;q=0.5\r\nX-XSRF-TOKEN: 989g8ddfgdf7979df\r\nタイムスタンプ: 2021-04-07T18:35:50.639Z\r\nContent-Type: application/json;charset=utf -8\r\nContent-Length: 340\r\nOrigin: https://example.com\r\nConnection: keep-alive\r\nReferer: https://my.example.com\r\n