Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # get the re library
- import re
- # this is the line to process
- xml_line = "<stuff><bad i_am_naughty="True"></bad></stuff>"
- # compile a regex
- exp = re.compile ("(.*)(<bad.*bad>)(.*)")
- # run the regex on the line
- match = exp.search (xml_line)
- # print out the groups the regex found
- print match.groups ()
Add Comment
Please, Sign In to add comment