bmatches函数主要是用来使用正则表达式 s1 来匹配 b1,并返回 bool 类型匹配结果的
bmatches
func (s1 string) bmatches(b1 bytes) bool
Response
HTTP/1.1 200 OK Server: nginx Date: Sat, 07 Jan 2023 10:41:06 GMT Content-Type: text/html; charset=utf-8 Connection: close Vary: Accept-Encoding Cache-Control: no-cache Content-Length: 373 root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
匹配语句:"root:.*?:[0-9]*:[0-9]*:".bmatches(response.body)
"root:.*?:[0-9]*:[0-9]*:".bmatches(response.body)
输出结果:true
true
匹配语句:"Accept-Enco.*".bmatches(response.raw)
"Accept-Enco.*".bmatches(response.raw)
Was this page helpful?