use py2.6 compatible substitution

By compiling with re.I and then doing the substitution from that
object. If the `i` flag is not found, fallsback to normal `compile`