Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2010 Doug Hellmann. All rights reserved.
  5. #
  6. """Substitute based on patterns.
  7. """
  8. #end_pymotw_header
  9.  
  10. import re
  11.  
  12. bold = re.compile(r'\*{2}(.*?)\*{2}', re.UNICODE)
  13.  
  14. text = 'Make this **bold**. This **too**.'
  15.  
  16. print 'Text:', text
  17. print 'Bold:', bold.subn(r'<b>\1</b>', text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement