# -*- coding:Utf-8 -*-
#导入re模块
import re
#\b匹配单词边界
result = re.match(r".*\bho\b","adf ho p qo34234")
print result.group()
#\B匹配非单词边界
result = re.match(r".+\Bho\B","adfhopqo34234")
print result.group()
#匹配分组
#1
#匹配qq 163 126的邮箱
'''email = raw_input("请输入邮箱")
result = re.match("\d+@(163|qq|126)\S\w+",email)
print result.group()'''
#2
#匹配html中的内容
result = re.findall(r"<html>(.*?)<html>","<html>hhhh<html>")
print result
result = re.compile("<html>(.*?)<html>",re.S)
itemlist = result.findall("<html>hhhh<html>")
print itemlist
#3
#search
#匹配文章的阅读次数
result = re.search(r"\d+","文章阅读书数,99999")
print result.group()
#4匹配网址
url = "http://baidu.com/message"
result = re.match(r"\w+.{3}\w+.{1}\w{3}.{1}",url)
print result.group()
#4split切割字符串
result = re.split(r":|/",url)
print result
'''adf ho adfho ['hhhh'] ['hhhh'] 99999 http://baidu.com/ ['http', '', '', 'baidu.com', 'message']
'''