- def re_find(pattern,text):
- import re
- txt=''
- try:find=re.compile(pattern).findall(text)
- except:return 'Error pattern'
- if not find:
- txt="Don't find anything"
- else:
- txt='Results:'
- for i in xrange( 0,len(find)):
- txt+='\n'+'['+str(i)+']'+find[i]
- return txt
-
-
- txt='''<html>
<meta author=blackw00d>
<body>
<br><tr><td>hello</td></tr><h1>bla</h1><a href="tyga">a Bot u ccbIJIka</a>
</body>
</html>'''
- pat='<[^>]+>'
- print re_find(pat,txt)