当前位置:网站首页>Regular expressions: mailbox matching
Regular expressions: mailbox matching
2022-07-27 14:44:00 【Live up to your youth】
Format Overview
Email address conforms to “ name @ domain name ” The rules . character “@” In the email address “ name ” and “ domain name ” Between , The email address name can only be made up of English letters 、 Numbers 、 Underline composition , Domain names are only allowed by English letters 、 Numbers 、“.”( Order number ) form .
such as ,[email protected]、[email protected] It is the mailbox that conforms to the above rules .
Mode description
[\w][email protected][A-Za-z]+(\.[A-Za-z0-9]+){1,2}
In two parts , The first part [\w]+ The name used to match the mailbox , Second part [\w]+(.[A-Za-z]+){1,2} Used to match the domain name .
\w Means match number 、 Letter 、 Underline ,[\w]+ Indicates matching one or more numbers 、 Letter 、 Underline ;[A-Za-z] Used to match a letter ,[A-Za-z]+ Used to match one or more letters ,.[A-Za-z]+ Used to match to .( Order number ) Start with one or more letters ,{1,2} Represents a matching expression (.[A-Za-z]+) Once or twice .
Be careful , This regular expression is not unique . There can be other forms :
\b[\w][email protected][A-Za-z]+(\.[A-Za-z0-9]+){1,2}\b
^\[email protected][A-Za-z]+(\.[A-Za-z0-9]+){1,}$
Examples of use
>>> import re
>>> pattern = r"[\w][email protected][A-Za-z]+(\.[A-Za-z0-9]+){1,2}\b"
# Conform to the format mailbox number
>>> email = "[email protected]"
>>> re.match(pattern, email)
<re.Match object; span=(0, 16), match='[email protected]m'>
# Email number that does not conform to the format , Contains special characters +
>>> email = "[email protected]"
>>> re.match(pattern, email)
None
边栏推荐
- Summary of basic knowledge of C language
- SLAM综述阅读笔记六:基于图像语义的SLAM调研:移动机器人自主导航面向应用的解决方案 2020
- Basic exercises of C language
- FPGA时序约束分享04_output delay 约束
- Redis
- Document translation__ Salt and pepper image denoising based on adaptive total variation L1 regularization
- DirectX 入门知识
- 基于招聘广告的岗位人才需求分析框架构建与实证研究
- [note] logistic regression
- 【医疗行业】DICOM converter Tools
猜你喜欢

What you want most is the most comprehensive summary of C language knowledge. Don't hurry to learn

Chapter 3 business function development (view clue details)

线程知识总结

Annual comprehensive analysis of China's online video market in 2022

在Oracle VirtualBox中导入Kali Linux官方制作的虚拟机

动态规划——股票买卖5

进程间通信

STM32 - capacitive touch button experiment

arduino+ZE08-CH2O甲醛模块,输出甲醛含量

文献翻译__基于自适应全变差L1正则化的椒盐图像去噪
随机推荐
watch VS watchEffect
HDU4565 So Easy! [matrix multiplication] [derivation]
2022 Niuke multi School II_ E I
Why does script file 'd:\anaconda3\envs\pad appear_ env\Scripts\pip-script. py‘ is not present.
Chapter 3 business function development (add clues and remarks, and automatically refresh the added content)
printf函数缓冲区问题
Annual comprehensive analysis of China's online video market in 2022
@Detailed explanation of repository
va_list 使用总结
一篇文章看懂JS执行上下文
codeforces 1708E - DFS Trees
Win11壁纸变黑怎么办?Win11壁纸变黑了的解决方法
Chinese character style transfer --- antagonistic discriminative domain adaptation (L1)
uniapp的request数据请求简单封装步骤
Graphic SQL of giant image
[cache series] completely solve the problems of cache avalanche, breakdown and penetration
一文搞懂 Redis 架构演化之路
arduino+ZE08-CH2O甲醛模块,输出甲醛含量
One of yolox improvements: add CBAM, Se, ECA attention mechanism
JS什么是声明提前?函数与变量声明提前的先后顺序(执行上下文铺垫篇)