I write this command to test a regex very ofter:
$ python -c 'import re; print(re.sub("e", "E", "hello"))'
hEllo
The problem is that when I import multiply modules, command becomes longer and longer.
If I can config python to import re; import XXX; import YYY; automatically,
the command becomes much shorter:
$ python -c 'print(re.sub("e", "E", "hello"))'
I think instead of configuring Python it’s much easier and more convenient to write a separate script to which you pass the regular expression to test:
And
test.pywill import all needed modules (not tested):