Ultra-simple human readable DSL for matching text.
Project description
SimpleMatch is a replacement for regular expressions that lets you write non-developer readable/writeable matching expressions.
To install:
$ pip install simex
To use:
>>> from simex import simex >>> LINK_EXPRESSION = """<a href="{{ url }}">{{ anything }}</a>""" >>> exp = simex(LINK_EXPRESSION, url=r"(.*?)", anything=r".*?") >>> exp.match("""<a href="http://www.cnn.com">CNN</a>""") is not None True >>> exp = simex(LINK_EXPRESSION, url=r"(.*?)") >>> assert exp.match("""<a href="http://www.cnn.com">{{ anything }}</a>""") True >>> exp = simex(LINK_EXPRESSION, url=r"(.*?)") >>> assert exp.search("""Pre text <a href="http://x.com">{{ anything }}</a> post text""") True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simex-0.1.1.tar.gz
(2.3 kB
view hashes)