python - 正则表达式 (?<=\s)\d(?=\s) 和 (?
为什么是表达式
(?<=\s)\d(?=\s)
和表达式不一样
(?<!\S)\d(?!\S)
?
如何分析电子邮件是否使用python请求
为什么是表达式
(?<=\s)\d(?=\s)
和表达式不一样
(?<!\S)\d(?!\S)
?
问题描述
为什么是表达式
(?<=\s)\d(?=\s)
和表达式不一样
(?<!\S)\d(?!\S)
?
如何分析电子邮件是否使用python请求注册而不呈现html?
我正在用 python 编写代码来分析电子邮件是否已在以下站点中注册:https ://www.infojobs.com.br/RememberPass.aspx
对于忘记密码,可以这样做,因为如果电子邮件错误,该网站会在电子邮件不存在时显示。但是用 python 请求分析这个过程。
import requests
import json
headers = {
'authority': 'www.infojobs.com.br',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
}
data = {
'__VIEWSTATEGENERATOR': 'D4C35ECA',
'cRemPassEmailCompany$txtEmail':'' ,
'cRemPassEmailCompany$txtCPNJ':'' ,
'cRemPassCandidate$txtEmail': 'daviluis400@gmail.com',
'cRemPassCandidate$btnStep1': 'Enviar',
'cRemPassCandidate$txtCPF':'',
'cRemPassCandidate$rbtlstSend': '1',
}
response = requests.post('https://www.infojobs.com.br/RememberPass.aspx',
headers=headers,data=data)
response2 = json.loads(response.text)
我想在不呈现 html 的情况下检查电子邮件。
解决方案
一个区别是,正向后视和前向要求正在寻找的那些字符存在,而负向环视则不需要。例如
1 2
将有 2 场比赛
(?<!\S)\d(?!\S)
但没有匹配
(?<=\s)\d(?=\s)
https://regex101.com/r/tjYc1o/1
(?=\s)
要求该数字后跟一个空格字符,因此如果该数字位于字符串的末尾,则该数字将不匹配,但如果(?!\S)
改为使用该数字,则负前瞻将通过,因为该数字位于字符串末尾后面没有非空白字符。
推荐阅读
- powershell - [System.Web.Security.Membership]::GeneratePassword() - 找不到类型
- c# - OnItemDataBound 将列表视图中的链接按钮注册到更新面板脚本管理器,但是,它们仅在第一次单击时起作用
- java - 具有相同存储库和实体的多个数据源
- database - 如何在 GDPR 下将用户名存储在数据库中?
- c - 比较频繁输入数据和存储 MAX 和 MIN 值的快速方法
- css - 即使删除了 margin 属性,元素仍然有边距
- jquery - Jquery Datepicker 输入
- python - Python3:仅将更新的 CSV 文件的新行添加到 MySQL 数据库
- jquery - 显示 Ajax 列表
- ios - iOS 分配给 BLE 设备的设备 UUID 是否随时间稳定?