Skip to content

Instantly share code, notes, and snippets.

@marceloleiva
Created July 17, 2015 18:47
Show Gist options
  • Save marceloleiva/096d8f9daf0c954d0da5 to your computer and use it in GitHub Desktop.
Save marceloleiva/096d8f9daf0c954d0da5 to your computer and use it in GitHub Desktop.
import re
cadena = "open('../Attachment/ViewAttachment.aspx?enc=%2fnzOJlvQE1Q5cGviPAFZ%2fAwP4DzDJBri%2bWK1%2fBimEpHECqkBoS5%2fQKtpmZ8x8fmj8rudm2jNRnGPgHzbTdOH3wtcK8STvRkmfjkfy8XUF6xwUBoBbErAErrL7%2bg3Tt6XjP5AEjY6C3dNZP8NBOhAKlniJExwmfRWBRMuA%2bUju6Isl8ncH617vzflGWloZhbNcolIDIK7lzetNeOBVdzdNVV6Yrz7sbhBYzTkIIjuxmZVoHFTrr7h0sqPmH%2bU5y5iaWXxqB%2f1h7awOfzQPqpOt6sg3ZpXKUvaD6XO8fikAjmcWJ3FqzcS3KRFNfiD4S7V','MercadoPublico', 'width=850, height=700, status=yes, scrollbars=yes, left=0, top=0, resizable=yes');window.event.returnValue=false;"
patron = r".+\?enc=([a-zA-Z0-9%]+)"
patron2 = r".*enc=([^']*).*"
resultado = re.match(patron, cadena)
print(resultado.group(1))
print('')
resultado2 = re.match(patron2, cadena)
print(resultado2.group(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment