{ "info": { "author": "Rafael Carrascosa", "author_email": "rafacarrascosa@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "REfO\r\n====\r\n\r\nLacking a proper name, REfO stands for \"Regular Expressions for Objects\".\r\n\r\nIt's a python library that supplies a functionality very similar to the python\r\n`re` module (regular expressions) but for arbitrary sequences of objects\r\ninstead of strings (sequences of characters).\r\n\r\nIn addition to that, it's possible to match each object in a sequence with\r\nnot only equality, but an arbitrary python function.\r\nFor example, if you have a sequence of integers you can make a regular\r\nexpression that asks for a even number followed by a prime number\r\nfollowed by a 3-divisible number.\r\n\r\nThis software was written by Rafael Carrascosa while working at Machinalis in\r\nthe first months of 2012.\r\n\r\nContact: rcarrascosa@machinalis.com\r\nor rafacarrascosa xyz gmail.com (replace \" xyz \" with \"@\")\r\n\r\nHow to use it\r\n-------------\r\n\r\nThe syntax is a little bit different than python's re, and similar to that of\r\npyparsing, you have to more-or-less explicitly build the syntax tree of\r\nyour regular expression. For instance:\r\n\r\n`\"ab\"` is `Literal(\"a\") + Literal(\"b\")`\r\n\r\n`\"a*\"` is `Star(Literal(\"a\"))`\r\n\r\n`\"(ab)+|(bb)*?\"` is:\r\n\r\n a = Literal(\"a\")\r\n b = Literal(\"b\")\r\n regex = Plus(a + b) | Star(b + b, greedy=False)\r\n\r\nYou can also assign a group to any sub-match and later on retrieve the matched\r\ncontent, for instance:\r\n\r\n regex = Group(Plus(a + b), \"foobar\") | (b + b)\r\n m = match(regex, \"abab\")\r\n print m.span(\"foobar\") # prints (0, 4)\r\n\r\nFor more, check out the examples in the examples folder.\r\n\r\n\r\nHow we use it\r\n-------------\r\n\r\nAt Machinalis we use REfO for applications similar to that in\r\n`examples/words.py`, check it out!\r\n\r\n\r\nAbout the implementation\r\n------------------------\r\n\r\nI use a Thompson-like virtual machine aproach, which ensures polynomial time\r\nworst-case complexity. See `examples/poly_time.py` for an example of this.\r\n\r\nThe implementation is heavily based on Russ Cox notes, see\r\nhttp://swtch.com/~rsc/regexp/regexp2.html for the source.\r\n\r\nIf you go to read the code, some glossary:\r\n\r\n - RE -- regular expression\r\n - VM -- virtual machine\r\n - Epsilon transitions -- All VM instructions that do not consume a symbol\r\n or stop the thread (for example an Accept).\r\n\r\n\r\nAcknowledgements\r\n----------------\r\n\r\nThanks Russ Cox for sharing the awesome info and insights on your web site.\r\n\r\nThanks Javier Mansilla for reviewing the code and being enthusiastic about it.\r\n\r\nThanks Machinalis for everything :)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/machinalis/refo", "keywords": "regular expressions,regexp,re,objects,classes", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "REfO", "package_url": "https://pypi.org/project/REfO/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/REfO/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/machinalis/refo" }, "release_url": "https://pypi.org/project/REfO/0.13/", "requires_dist": null, "requires_python": null, "summary": "Regular expressions for objects", "version": "0.13" }, "last_serial": 1252188, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "8169467b93667876d8ca139b2164a909", "sha256": "41c678ec29bddd7a0cc08f226e9f1a597a6f4fc3df33a13f1bce83e3d2d875dd" }, "downloads": -1, "filename": "REfO-0.1.tar.gz", "has_sig": false, "md5_digest": "8169467b93667876d8ca139b2164a909", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18885, "upload_time": "2012-09-16T21:29:40", "url": "https://files.pythonhosted.org/packages/1f/3a/d62eabc0c3e8d01668f7c54053eb1be14d5148e313868a453b21776e7c67/REfO-0.1.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "3f26012f1b147fcac26837d35914f119", "sha256": "5789e52854b2d821f8a3f531bcb35db37db761ed4bd8cd886973afa96d73c39e" }, "downloads": -1, "filename": "REfO-0.11.tar.gz", "has_sig": false, "md5_digest": "3f26012f1b147fcac26837d35914f119", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18924, "upload_time": "2012-12-01T00:26:56", "url": "https://files.pythonhosted.org/packages/e8/86/85ddf66cec031fb257a736157f32430441b77ca27936b0d7dbcfb1538e25/REfO-0.11.tar.gz" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "e55ec998f0c15e1cdfb593cafc01ccbc", "sha256": "ba55e5fb8bfd3c92d570498360c6c90321b1c3395176d391356db7d98069f188" }, "downloads": -1, "filename": "REfO-0.12.tar.gz", "has_sig": false, "md5_digest": "e55ec998f0c15e1cdfb593cafc01ccbc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7529, "upload_time": "2012-12-05T19:14:56", "url": "https://files.pythonhosted.org/packages/7a/75/5ef7cd51ba9b2cd6db1858a2cfdabb9eee5468ff773cdb6132fa55239c55/REfO-0.12.tar.gz" } ], "0.13": [ { "comment_text": "", "digests": { "md5": "0548a33f4713d2d2f8932195df918de6", "sha256": "f5c9fd5d6ae083b15071a27ebdf02353c7af9ecc92e22b67f961ecdf5e0355f4" }, "downloads": -1, "filename": "REfO-0.13.tar.gz", "has_sig": false, "md5_digest": "0548a33f4713d2d2f8932195df918de6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12037, "upload_time": "2014-10-08T20:16:53", "url": "https://files.pythonhosted.org/packages/51/b1/fe3af8c96aa634a9502bec5622aadc2e27880843a1da2c5869435772b075/REfO-0.13.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0548a33f4713d2d2f8932195df918de6", "sha256": "f5c9fd5d6ae083b15071a27ebdf02353c7af9ecc92e22b67f961ecdf5e0355f4" }, "downloads": -1, "filename": "REfO-0.13.tar.gz", "has_sig": false, "md5_digest": "0548a33f4713d2d2f8932195df918de6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12037, "upload_time": "2014-10-08T20:16:53", "url": "https://files.pythonhosted.org/packages/51/b1/fe3af8c96aa634a9502bec5622aadc2e27880843a1da2c5869435772b075/REfO-0.13.tar.gz" } ] }