{ "info": { "author": "Colm O'Connor", "author_email": "colm.oconnor.github@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Unix", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries" ], "description": "SimEx\n=====\n\nSimEx is a tool that lets you write simple, readable equivalents of regular expressions that\ncompile down to regular expressions.\n\nThis is useful for:\n\n* Improving the readability and maintainability of code that uses long regexes with a lot of escaped characters.\n* Allowing non-developers to read and understand simple regex-equivalents and potentially even write their own.\n\nSimex is *not* a full replacement for regular expressions and its use is not suitable everywhere a regex is used.\n\nIt is ideally used where you usually want to compare two strings but you occasionally need to compare two\nstrings with a pattern embedded within them.\n\nIt is an embodiment of `the rule of least power `_.\n\nTo install::\n\n $ pip install simex\n\n\nExample\n-------\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> simex = Simex({\"url\": r\".*?\", \"anything\": r\".*?\"})\n >>> regex = simex.compile(\"\"\"{{ anything }}\"\"\")\n >>> regex.match(\"\"\"CNN\"\"\") is not None\n True\n\n\nDo I have to define all of the sub-regular expressions myself?\n--------------------------------------------------------------\n\nNo. SimEx also contains a built in library of commonly used regular expressions.\n\nThis will also work:\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> my_simex = DefaultSimex()\n >>> regex = my_simex.compile(\"\"\"{{ anything }}\"\"\")\n >>> regex\n re.compile(r'\\.*?\\<\\/a\\>', re.UNICODE)\n\n >>> regex.match(\"\"\"CNN\"\"\") is not None\n\nAll regexes in the existing library can be overridden, and more can be added, e.g.\n\n.. code-block:: python\n\n >>> simex = DefaultSimex({\"url\": r\".*?\", \"mycode\": r\"[A-Z][0-9][0-9][0-9]\"})\n\nCurrently there are five in the list of pre-defined regexes:\n\n* URL\n* Email\n* Integer\n* Number\n* Anything\n\nPull requests with commonly required non-controversial regexes are welcome.\n\n\nUsing {{ and }} creates conflicts for me! Why not [[[ and ]]]?\n--------------------------------------------------------------\n\n{{ and }} have a special meaning in some languages which you may want to use\nwith simex - e.g. jinja2.\n\nIn order to prevent confusion in such circumstances, you can define your\nown delimeters:\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> simex = Simex(open_delimeter=\"[[[\", close_delimeter=\"]]]\")\n >>> simex.compile(\"\"\"[[[ anything ]]]\"\"\")\n >>> simex.match(\"\"\"CNN\"\"\") is not None\n\n\nMatching exact strings\n----------------------\n\nBy default a simex will not match an exact string. i.e. it will produce:\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> simex = Simex({\"url\": r\".*?\", \"anything\": r\".*?\"})\n >>> regex = simex.compile(\"\"\"{{ anything }}\"\"\")\n >>> regex\n re.compile(r'\\.*?\\<\\/a\\>', re.UNICODE)\n >>> regex.match(\"\"\"CNN THERE IS MORE TEXT\"\"\") is not None\n True\n\nHowever, if you want, simexes can be used to do exact matching. For example:\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> simex = Simex({\"url\": r\".*?\", \"anything\": r\".*?\"}, exact=True)\n >>> regex = simex.compile(\"\"\"{{ anything }}\"\"\")\n >>> regex\n re.compile(r'^\\.*?\\<\\/a\\>$', re.UNICODE)\n >>> regex.match(\"\"\"CNN\"\"\") is not None\n True\n >>> regex.match(\"\"\"CNN THERE IS MORE TEXT\"\"\") is not None\n False\n\nMatching can also treat whitespace (tabs, spaces and newlines) as interchangeable. For example:\n\n.. code-block:: python\n\n >>> from simex import Simex\n >>> simex = Simex({\"url\": r\".*?\", \"anything\": r\".*?\"}, flexible_whitespace=True)\n >>> regex = simex.compile(\"\"\"{{ anything }}\"\"\")\n >>> regex\n re.compile(r'\\.*?\\<\\/a\\>', re.UNICODE)\n >>> regex.match(\"\"\"CNN\"\"\") is not None\n True\n\n.. code-block:: python\n\n\n\nHow does it work?\n-----------------\n\nThe regular expression simply escapes an entire simexpression, except for the\ncomponents surrounded by {{ and }}, which it replaces with defined regular\nexpressions - like \"email\" or \"anything\" or \"number\" defined in the dict.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/crdoconnor/simex", "keywords": "regex text matching", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "simex", "package_url": "https://pypi.org/project/simex/", "platform": "", "project_url": "https://pypi.org/project/simex/", "project_urls": { "Homepage": "https://github.com/crdoconnor/simex" }, "release_url": "https://pypi.org/project/simex/0.3.5/", "requires_dist": null, "requires_python": "", "summary": "Ultra-simple human readable DSL for matching text.", "version": "0.3.5" }, "last_serial": 2621123, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "495f83fe1225f757d9cfe32c2909fe6e", "sha256": "1d4a221b16afa75e1f94224a08ffffc6847134771fbc5e81e29fdf99c33ba0a4" }, "downloads": -1, "filename": "simex-0.1.tar.gz", "has_sig": false, "md5_digest": "495f83fe1225f757d9cfe32c2909fe6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2057, "upload_time": "2016-08-09T19:01:49", "url": "https://files.pythonhosted.org/packages/85/b9/70f502c636b5597686c37cb3f39a1bdeb1ea68a6ad22f8d22900f207c59d/simex-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ff52b54201f6f966e9f9cf7b6456f674", "sha256": "a42f47bb1bd6feccccad16832e626fda84c9486433df8d963b2d487864f2e960" }, "downloads": -1, "filename": "simex-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ff52b54201f6f966e9f9cf7b6456f674", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2320, "upload_time": "2016-08-09T19:05:24", "url": "https://files.pythonhosted.org/packages/1c/03/b03559bba342f34ab492680a1d5fb4123d9b661b1496fe5ad02da28f14c9/simex-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ca1e2847e0280b9a9e2401ba155fd176", "sha256": "84632ad97c2aadb635573b6df215fba8230795dd0630eb166f76f6f1b6ce4684" }, "downloads": -1, "filename": "simex-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ca1e2847e0280b9a9e2401ba155fd176", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2416, "upload_time": "2016-08-09T23:37:26", "url": "https://files.pythonhosted.org/packages/31/77/a18c24a5de83496b7e0dc82d6d85c54646fac94aba395bdecde1f614748c/simex-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "e05a26117bc01375035ea942741727ff", "sha256": "4c48662ca953303017869ee8025b76770cba3d95aa5e8f9028549513180f338d" }, "downloads": -1, "filename": "simex-0.3.0.tar.gz", "has_sig": false, "md5_digest": "e05a26117bc01375035ea942741727ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3724, "upload_time": "2016-10-30T11:59:31", "url": "https://files.pythonhosted.org/packages/33/ac/58813cc7356c11dc9256b66506b382d9ccfb07ff73055796ef1be30cc255/simex-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "97eccdb24a5cf3d3accb375114156687", "sha256": "0021c33d98964992e3949b768cf605e65d502cb87544c26a07af14ec11ee2f87" }, "downloads": -1, "filename": "simex-0.3.1.tar.gz", "has_sig": false, "md5_digest": "97eccdb24a5cf3d3accb375114156687", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3804, "upload_time": "2016-11-20T14:28:24", "url": "https://files.pythonhosted.org/packages/b5/3a/1311a0c2109ccd9c8add2806ba2fc42948cf00d6bca97d71ab5c9c45a285/simex-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "ed11a9d5c5b61e77e584bbf266a81c36", "sha256": "fda0c143d5754d54b717f02b467b37abbacb126737484084e5f6bd43abd3d4a5" }, "downloads": -1, "filename": "simex-0.3.2.tar.gz", "has_sig": false, "md5_digest": "ed11a9d5c5b61e77e584bbf266a81c36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4115, "upload_time": "2016-12-04T12:58:11", "url": "https://files.pythonhosted.org/packages/9c/09/484171219ab1296160758660407131c5ab32e6bc3e339db0a24fcc56b7ed/simex-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "66fcdc531df890cae955f12d6a3b3241", "sha256": "85a1549c7678065ca5709edbd483304a5322ea06d08da92987e5389faffc65ae" }, "downloads": -1, "filename": "simex-0.3.3.tar.gz", "has_sig": false, "md5_digest": "66fcdc531df890cae955f12d6a3b3241", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4302, "upload_time": "2016-12-17T13:31:38", "url": "https://files.pythonhosted.org/packages/6a/22/2ff43c1b10b3967b5aecd6a661bdfa8fde801cf1573f0268e8699b05878b/simex-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "74825a04d743adb8daa6f112320b16a1", "sha256": "eaaabab876441823b442dfece61a161dd934e9fa0c12e850baf573d91c98c0da" }, "downloads": -1, "filename": "simex-0.3.4.tar.gz", "has_sig": false, "md5_digest": "74825a04d743adb8daa6f112320b16a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4428, "upload_time": "2016-12-22T18:36:00", "url": "https://files.pythonhosted.org/packages/84/42/2ca9f901fde9e77d7d82ee434c8aaaaada9856c401d1b4df4af4b41439dc/simex-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "1921f2f4f5c4f6aaa5a3c57967cd280c", "sha256": "78b8fa89edbc6375085715a89365475aa294e3499070243c74c8b515e7c33608" }, "downloads": -1, "filename": "simex-0.3.5.tar.gz", "has_sig": false, "md5_digest": "1921f2f4f5c4f6aaa5a3c57967cd280c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4398, "upload_time": "2017-02-05T20:51:51", "url": "https://files.pythonhosted.org/packages/02/1f/d741eed51732130178e503d3a7978a930ec68f86aee47d3f54627853a952/simex-0.3.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1921f2f4f5c4f6aaa5a3c57967cd280c", "sha256": "78b8fa89edbc6375085715a89365475aa294e3499070243c74c8b515e7c33608" }, "downloads": -1, "filename": "simex-0.3.5.tar.gz", "has_sig": false, "md5_digest": "1921f2f4f5c4f6aaa5a3c57967cd280c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4398, "upload_time": "2017-02-05T20:51:51", "url": "https://files.pythonhosted.org/packages/02/1f/d741eed51732130178e503d3a7978a930ec68f86aee47d3f54627853a952/simex-0.3.5.tar.gz" } ] }