{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# cffi_re2\n[![Build Status](https://travis-ci.org/vls/cffi_re2.png)](https://travis-ci.org/vls/cffi_re2)\n\ncffi_re2 is a cffi-based high-level Python binding for Google's [re2](https://github.com/google/re2) library.\n\n### Installation\n\nBefore installing cffi_re2, you will need to install re2. On Ubuntu/Debian you can do that using\n\n```bash\nsudo apt-get install libre2-dev\n```\n\nElse, you can simply install the current version from the git repository:\n\n```bash\ngit clone https://github.com/google/re2.git\nmake\nmake test\nsudo make install\n```\n\nSee the [re2 repository](https://github.com/google/re2) for further information.\n\nAfter installing re2, you can install cffi_re2:\n\n```bash\npip install cffi_re2\n```\nor from a local copy:\n```bash\nsudo python setup.py install\n```\n\n*cffi_re2* is fully compatbile with both *Python3.x* as well as [*PyPy*](pypy.org) (including *PyPy3*). \n\nYou can run the unit tests using:\n```bash\nsudo python setup.py test\n```\n\n### Using cffi_re2\n\n*cffi_re2* is mostly compatible to the *re* module from the Python standard library and exposes the same interface. In almost all cases you can use the same source code for both libraries. The flags in `cffi_re2` are exactly the same as those in `re`, so you can e.g. use `re.IGNORECASE` in `cffi_re2.compile` and vice versa.\n\nOne way to use *cffi_re2* is:\n\n```python\nimport cffi_re2 as re\n```\n\nNote however, that, due to the design of the [*RE2*](https://github.com/google/re2) library, some syntax elements like zero-width lookaheads or lookbehinds are [not supported](https://github.com/google/re2/wiki/Syntax).\n\nWhen using those syntax elements, the backend reports a syntax error when calling `cffi_re2.compile`, for example:\n\n```\nValueError: invalid perl operator: (?<\n```\n\nOne workaround is to convert your regex into a group-capturing form and select the appropriate group later. For larger sets of complex regular expressions, this is often not feasible, however.\n\nIn this case, it is recommended to use a hybrid approach, i.e. falling back to *re* if *cffi_re2* fails to compile an expression.\n\n```python\nimport re\nimport cffi_re2\n\ndef compileRegex(rgx, flags=0):\n try:\n return cffi_re2.compile(rgx, flags)\n except ValueError:\n return re.compile(rgx, flags)\n``` \n\nNote that in the current implementation there are still several known and unknown incompatibilities between *cffi_re2* and *re*. If you encounter issues, please report them as a bug.\n\n### Benchmarks\n\n### About\n\n*cffi_re2* was originally developed by [Liang Zhaohao](https://github.com/vls). Many new features and improvements were contributed by [Uli K\u00f6hler](https://github.com/ulikoehler).\n\nThe library is licensed under the MIT license (see LICENSE file).", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vls/cffi_re2", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "cffi_re2", "package_url": "https://pypi.org/project/cffi_re2/", "platform": "", "project_url": "https://pypi.org/project/cffi_re2/", "project_urls": { "Homepage": "https://github.com/vls/cffi_re2" }, "release_url": "https://pypi.org/project/cffi_re2/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Access re2 library using cffi", "version": "0.2.1" }, "last_serial": 2732910, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "9c5f9257199d482e5bac6554b7ba4af2", "sha256": "8e0a15b61c1b20ab762e8b1c474cf33984992e1679de62a59b9759bd05d647a2" }, "downloads": -1, "filename": "cffi_re2-0.1.tar.gz", "has_sig": false, "md5_digest": "9c5f9257199d482e5bac6554b7ba4af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1881, "upload_time": "2014-12-18T11:27:30", "url": "https://files.pythonhosted.org/packages/c9/ad/14198875e338996b32ad2980275710d71dae6026a46d1db23a69f4c1484b/cffi_re2-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1e165b4a1b92430fd19ec4113a3e3e47", "sha256": "5535e1bcebd1b43dfa93ef4739ce3e4c2b5d2eb3f28543a216d5ec1e5323470d" }, "downloads": -1, "filename": "cffi_re2-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1e165b4a1b92430fd19ec4113a3e3e47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2037, "upload_time": "2014-12-18T11:33:04", "url": "https://files.pythonhosted.org/packages/29/74/83252e6f7d1ad8a14beb13179f7fc611db877535f1cea51691d783225ced/cffi_re2-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "75f8c3057c04e4d48d46e2e4079c586c", "sha256": "e4c40fd8b41af49a33718427e1886549eec997342f2576ff8308d89aec38f77c" }, "downloads": -1, "filename": "cffi_re2-0.1.2.tar.gz", "has_sig": false, "md5_digest": "75f8c3057c04e4d48d46e2e4079c586c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2046, "upload_time": "2014-12-18T11:34:02", "url": "https://files.pythonhosted.org/packages/5c/28/94fd77b08fcfec5d90193f7ff81694c6d00f567d650ed2d759102109b2ab/cffi_re2-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "d3015c6e07336a365322d9044e321c63", "sha256": "2e7caa6295723c7438e5e74d28bfc5115f1e10d5ca7c420b0d1d3b1985d022de" }, "downloads": -1, "filename": "cffi_re2-0.1.3.tar.gz", "has_sig": false, "md5_digest": "d3015c6e07336a365322d9044e321c63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2076, "upload_time": "2014-12-18T11:36:55", "url": "https://files.pythonhosted.org/packages/65/ec/52a204bf334c59403a55b3075c6564fcc3d8781b3e4c112b34bf3d8eb3d9/cffi_re2-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "89e226212faee693f0390e058932c105", "sha256": "caafb19f55a1e038cacb61ac96fdda670f289f574f44e1914b28a53c70ae1ce3" }, "downloads": -1, "filename": "cffi_re2-0.1.4.tar.gz", "has_sig": false, "md5_digest": "89e226212faee693f0390e058932c105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2234, "upload_time": "2015-02-28T01:30:29", "url": "https://files.pythonhosted.org/packages/05/f6/f12ff5015cedcd98c4e7968a92ff4c8dd1bb9fd7368e3295f98868080350/cffi_re2-0.1.4.tar.gz" } ], "0.2.0": [], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b83c6595f8c10a5b78cc17ae911359da", "sha256": "91f02eaec203d7e0d6bf08a91cdf340fc9187d4695b0139b5dff3070bf0b6165" }, "downloads": -1, "filename": "cffi_re2-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b83c6595f8c10a5b78cc17ae911359da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7927, "upload_time": "2017-03-27T08:16:21", "url": "https://files.pythonhosted.org/packages/05/bf/280be6b2323b137589e4e03017eb77b9d5cdf32b14f4f51d99061eb43fc4/cffi_re2-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b83c6595f8c10a5b78cc17ae911359da", "sha256": "91f02eaec203d7e0d6bf08a91cdf340fc9187d4695b0139b5dff3070bf0b6165" }, "downloads": -1, "filename": "cffi_re2-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b83c6595f8c10a5b78cc17ae911359da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7927, "upload_time": "2017-03-27T08:16:21", "url": "https://files.pythonhosted.org/packages/05/bf/280be6b2323b137589e4e03017eb77b9d5cdf32b14f4f51d99061eb43fc4/cffi_re2-0.2.1.tar.gz" } ] }