Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import re
- # Precompile the patterns
- regexes = [re.compile(p)
- for p in ['this', 'that']
- ]
- text = 'Does this text match the pattern?'
- print 'Text: %r\n' % text
- for regex in regexes:
- print 'Seeking "%s" ->' % regex.pattern,
- if regex.search(text):
- print 'match!'
- else:
- print 'no match'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement