python正则表达式示例
2015-09-09 20:58
363 查看
#encoding='utf-8' ''' @author: Administrator ''' import re class MyClass(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' self.p1=re.compile('<div><a name=>(.+).*?</a>') self.p=re.compile('<div><a name=>(.+)</a>') def fun(self,_str): _temp=self.p.findall(_str)[0] return _temp if __name__ == '__main__': _str="<div><a name=>/fdsa/ff/order?fdsafd={ddd}</br>&fdsafds={ddd}</a>" myClass=MyClass() _temp= myClass.fun(_str) print _temp _temp=_temp.replace('</br>','') print _temp
运行结果:
相关文章推荐
- python正则表达式判断字符串是否是全部小写示例
- Python正则表达式实现简易计算器功能示例
- python正则表达式判断字符串是否是全部小写示例
- 正则表达式快速入门(python示例)
- Python正则表达式(增加详细示例code)
- 【Python】正则表达式-简单示例
- python 正则表达式用法示例
- python使用正则表达式匹配字符串开头并打印示例
- Python正则表达式匹配中文用法示例
- python利用正则表达式排除集合中字符的功能示例
- Python使用正则表达式抓取网页图片的方法示例
- Python3使用正则表达式爬取内涵段子示例
- Python正则表达式的简单应用和示例演示
- python中如何使用正则表达式的非贪婪模式示例
- Python正则表达式的简单应用和示例演示
- Python正则表达式应用示例
- python中如何使用正则表达式的集合字符示例
- [Python]正则表达式(...)分组的扩展示例
- Python使用中文正则表达式匹配指定中文字符串的方法示例
- python中使用正则表达式的连接符示例代码