Guest User

Untitled

a guest
Jun 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. # get the re library
  2. import re
  3.  
  4. # this is the line to process
  5. xml_line = "<stuff><bad i_am_naughty="True"></bad></stuff>"
  6. # compile a regex
  7. exp = re.compile ("(.*)(<bad.*bad>)(.*)")
  8. # run the regex on the line
  9. match = exp.search (xml_line)
  10. # print out the groups the regex found
  11. print match.groups ()
Add Comment
Please, Sign In to add comment