Created by Andrew Clarkson @_andrewclarkson
import re csv = "first,last,phone" re.match("^(.*,){2}p", csv)
csv = "first,last,something else"
Exponential time is fine for small n
import re n = 5 text = "a" * n regex = "^(a?){n}a{n}".replace("n", str(n)) re.match(regex, text)
P.S. I've never actually finished n = 30
./pathological-backtracking.py
(aw-tom-uh-tuh)
./pathological-nfa.py
Generates a Non-Deterministic Finite State Automaton
(ab|c)*|d
becomes
ab.c|*d|
a
ab.
ab|
a*
a+
a?