# httpheader ver.4
---
## 此次成果
研究正則表達法 觀看別人如何模組化 切割header
---
## demo

當此header需要有多個判斷的時候json檔會是list的形式
像setcookies裡有httponly,secure...
enumerate多用於在for循環中得到計數,利用它可以同時獲得索引和值,即需要index和value值的時候可以使用enumerate
enumerate()返回的是一個enumerate對象

判斷httponly沒有設定
^((?!httponly).)*$
^在起始處匹配,如果有MULTILINE標誌,則在每個換行符後匹配
負前瞻: ?! (?!httponly) 有httponly 丟掉整串 沒有httponly 當作空的 等於就是比對.
*匹配前面的字符0次或多次 . .. ... .... 直到結束
$在結尾處匹配,如果有MULTILINE標誌,則在每個換行符前匹配
---
## 參考模板
https://github.com/gildasio/h2t
---
---
## demo
---
## 下次計畫
成功將bad header模組化出來(利用正則加json)
(result回傳)
---
## 參考資料
#### requests.get文件
https://requests.readthedocs.io/en/v0.8.4/api/
#### python re用法
https://kknews.cc/zh-tw/code/n6ayvyg.html
https://kknews.cc/zh-tw/code/jra6b9y.html
https://zh.wikipedia.org/zh-tw/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F
### 正則模擬器
https://regex101.com/
#### python enumerate
https://www.itread01.com/content/1510942965.html
#### isinstance type
https://www.runoob.com/python/python-func-isinstance.html
## 問題
{"metaMigratedAt":"2023-06-15T14:41:35.888Z","metaMigratedFrom":"Content","title":"httpheader ver.4","breaks":true,"contributors":"[{\"id\":\"20b2b63c-1d0e-463f-83a7-ed4434682f10\",\"add\":1434,\"del\":350}]"}