Skip to content

Instantly share code, notes, and snippets.

View sorcio's full-sized avatar

Davide Rizzo sorcio

View GitHub Profile
@sorcio
sorcio / randre.py
Last active July 3, 2017 16:54 — forked from anonymous/randre.py
Exploiting Python sre_parse internal to generate random text with regular expressions
import random
import sre_parse
MAX_ALLOWED_REPEATS = 100
def randre(re_text):
pattern = sre_parse.parse(re_text)
return Generator().gen_pattern(pattern)