#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:albert time:2019/1/14
import re
mail_str = '123邮箱是1169412995@qq.com /\?,大发大索+夫多三xieyuanchuan@chinasoftinc.com,的萨?芬.撒地方撒地方12432ddfasd@163.com dasfasdf,dasd都是001Abc@lenovo.com.cn ?'
regex = '[0-9a-zA-Z_-]+@[0-9a-zA-Z_-]+[\\.0-9a-zA-Z_-]+'
p = re.findall(regex,mail_str)
print(p)
# 一、元字符
# http://www.cnblogs.com/dyfblog/p/5880728.html
# 二、模式
print(re.I)
print(re.L)
print(re.M)
print(re.S)
print(re.U)
print(re.X)
# 三、函数
regex2 = re.compile(pattern='.+',flags=0)
res = re.findall(regex2, mail_str)
print(res)
rex = re.escape('?')
x = re.findall(rex, mail_str)
print(x)
ite = re.finditer(rex,mail_str)
for i in ite:
print(i.group())
print(ite)
m = re.match('\d+',mail_str)
print(m.group())
re.purge()
s = re.search(rex,mail_str)
print(s.group())
print(s.span())
sp = re.split(rex,mail_str)
print(sp)
su = re.sub(regex,r'',mail_str)
print(su)
08-16
08-16