Terregex is structural regex transformation library.
You can install this library via PyPI.
pip install terregex
from terregex import Transformer, Literal
trans = Transformer()
@trans.add_rule()
def transform_literal(node: Literal):
node.string = node.string.lower()
trans('(Foo|Bar)+') # => '(foo|bar)+'