为什么是表达式

(?<=\s)\d(?=\s)

和表达式不一样

(?<!\S)\d(?!\S)

?


如何分析电子邮件是否使用python请求,python,regex,python-3.x"/>

首页 > 解决方案 > 正则表达式 (?<=\s)\d(?=\s) 和 (?

为什么是表达式

(?<=\s)\d(?=\s)

和表达式不一样

(?<!\S)\d(?!\S)

?


如何分析电子邮件是否使用python请求

问题描述

为什么是表达式

(?<=\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 的情况下检查电子邮件。

标签: pythonregexpython-3.x

解决方案


一个区别是,正向后视和前向要求正在寻找的那些字符存在,而负向环视则不需要。例如

1 2

将有 2 场比赛

(?<!\S)\d(?!\S)

但没有匹配

(?<=\s)\d(?=\s)

https://regex101.com/r/tjYc1o/1

(?=\s)要求该数字后跟一个空格字符,因此如果该数字位于字符串的末尾,则该数字将不匹配,但如果(?!\S)改为使用该数字,则负前瞻将通过,因为该数字位于字符串末尾后面没有非空白字符。


推荐阅读