Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <ref>*Any_Character_Could_Be_Here</ref>
  2.  
  3. >>> import re
  4. >>> test_string = '''<ref>*Any_Character_Could_Be_Here</ref>
  5. <ref>other characters could be here</ref>'''
  6. >>> re.findall(r'<ref>.*?</ref>', test_string)
  7. ['<ref>*Any_Character_Could_Be_Here</ref>', '<ref>other characters could be here</ref>'] # a list of matching strings
  8.  
  9. if re.search(r"<ref>*[^<]*</ref>", subject):
  10. # Successful match
  11. else:
  12. # Match attempt failed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement