Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # encoding: utf-8
- #
- # Copyright (c) 2010 Doug Hellmann. All rights reserved.
- #
- """Substitute based on patterns.
- """
- #end_pymotw_header
- import re
- bold = re.compile(r'\*{2}(.*?)\*{2}')
- text = 'Make this **bold**. This **too**.'
- print 'Text:', text
- print 'Bold:', bold.sub(r'<b>\1</b>', text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement