当前位置:网站首页>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
边栏推荐
- Why does script file 'd:\anaconda3\envs\pad appear_ env\Scripts\pip-script. py‘ is not present.
- @Repository详解
- Interprocess communication
- log4j2 jdbc appender
- SLAM综述阅读笔记七:Visual and Visual-Inertial SLAM: State of the Art, Classification,and Experimental 2021
- watch VS watchEffect
- Carla notes (04) - client and world (create client, connect world, batch object, set weather, set lights, world snapshots)
- Win11壁纸变黑怎么办?Win11壁纸变黑了的解决方法
- RTL8762DK 环境搭建(一)
- SLAM综述阅读笔记六:基于图像语义的SLAM调研:移动机器人自主导航面向应用的解决方案 2020
猜你喜欢
![[popular science] the difference and connection between accuracy and resolution](/img/12/efcce1f6b8801d8d8b08b79818632c.png)
[popular science] the difference and connection between accuracy and resolution

Recursive method to realize the greatest common divisor

FPGA timing constraint sharing 04_ Output delay constraint

融合迁移学习与文本增强的中文成语隐喻知识识别与关联研究

Navicate报错access violation at address 00000000

10 practical uses of NFT

SLAM综述阅读笔记四:A Survey on Deep Learning for Localization and Mapping: Towards the Age of Spatial 2020

文献翻译__tvreg v2:用于去噪、反卷积、修复和分割的变分成像方法(部分)

Construction and empirical research of post talent demand analysis framework based on recruitment advertisement

STM32 - capacitive touch button experiment
随机推荐
Why does script file 'd:\anaconda3\envs\pad appear_ env\Scripts\pip-script. py‘ is not present.
Windows10 installing SQL Server 2019
【STM32】EXTI
JS什么是声明提前?函数与变量声明提前的先后顺序(执行上下文铺垫篇)
This points to problems, closures, and recursion
Is the security of online brokerage app account opening guaranteed?
Blocking queue
DVWA全级别通关教程
Chapter 3 business function development (add clues and remarks, and automatically refresh the added content)
Simple encapsulation steps of request data request of uniapp
< C> C language hash table usage
数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
次小生成树【模板】
基于预训练模型的多标签专利分类研究
Lesson 3: reverse word order
What if win11 wallpaper turns black? The solution of win11 wallpaper blackening
在Oracle VirtualBox中导入Kali Linux官方制作的虚拟机
线程知识总结
Chapter 3 business function development (view clue details)
mysql保存数据提示:Out of range value for column错误