Will regex be the final name of the module?

Create issue
Issue #184 closed
Former user created an issue

Hi, First of all I'm sorry that I'm using bug reporting to ask questions, but I don't see any other option for that.

I just want to know if regex is going to be the target name or if you're going to change it to re when it comes of of beta? I'm asking because I'm using this module now and I'm wondering if I can just 'import regex' or if it's better to 'import regex as re'?

I would also like to know if there's a way to set VERSION1 behaviour globally at the start of my script instead of using (?V1) in every regex?

Thank you in advance for your reply.

Comments (3)

  1. Matthew Barnett repo owner

    Python used to have a regex module called "regex". Then the "re" module was added, but it had a different API, and for several versions they coexisted. The old "regex" module was finally dropped after Python 2.4.

    In the case of this "regex" module, it has the same API as the "re" module, so you can switch without breaking existing code.

    Because of this compatibility, I can see no good reason not to call it "re" if it's put into the standard library, but as long as they are different modules, they should have different names.

    As for your second issue, the default version is specified by regex.DEFAULT_VERSION, so you just need to change that.

  2. Log in to comment