
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
.. figure:: http://i.imgur.com/N7uilEZ.png :alt: Easy does it!
Easy does it!
The world's most gangsta regular expressions library.
It turns this..
.. code:: python
regex = re.compile(r'(?:(?:\$){1,1})(?:(?:(?:\d)){1,})(?:(?:\.){1,1})(?:\d)(?:\d)')
into this!
.. code:: python
from easy_expressions import Easy
easy = Easy() /
.find("$") /
.min(1).digits() /
.then(".") /
.digit() /
.digit()
regex = easy.getRegex()
regex.findall("$10.00");
easy-expressions is a python regular expressions library with a
Python for Humans <https://speakerdeck.com/kennethreitz/python-for-humans>
__
philosophy. Rather than having to remember the complex regular
expressions syntax, easy-expressions allows you to write complicated
regular expressions in natural English, so you'll get your pattern
matches right the first time without any headache.
::
pip install easy-expressions
Searching for dollar amounts
.. code:: python
from easy_expressions import Easy
easy = Easy() /
.find("$") /
.min(1).digits() /
.then(".") /
.digit() /
.digit()
regex.test("$10.00"); # True
regex.test("$XX.YZ"); # False
Searching for Credit Cards
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
easy = Easy() \
.startOfLine() \
.exactly(4).digits() \
.then('-') \
.exactly(4).digits() \
.then('-') \
.exactly(4).digits() \
.then('-') \
.exactly(4).digits()
input_s = "Hey Joe! The credit card number for the invoice is 4444-5555-6666-7777. Thanks!"
easy.test(input_s) # True
input_s = "Hey Joe! The credit card number for the invoice is 1-2-3-4. Thanks!"
easy.test(input_s) # False
Inspiration
-----------
Regexes are hard when they should be easy.
I had this idea while watching Straight Outta Compton. Turns out
[@thebinarysearchtree](https://github.com/thebinarysearchtree/) had
already `implemented it in
JS <https://github.com/thebinarysearchtree/regexpbuilderjs>`__, so this
is essentially a port of that.
Contributing
------------
This software is still quite young and I'm certain there are still bugs
in it. If you find bugs or want new features included, please create a
new Issue and send a pull request, along with an accompanying test.
Thanks!
Other Easy Projects
-------------------
If you like easy things, you may also enjoy:
- `django-easy-api <https://github.com/Miserlou/django-easy-api>`__
- `django-easy-split <https://github.com/Miserlou/django-easy-split>`__
- `django-easy-timezones <https://github.com/Miserlou/django-easy-timezones>`__
- `django-knockout-modeler <https://github.com/Miserlou/django-knockout-modeler>`__
- `simpleaws <https://github.com/Miserlou/simpleaws>`__
License
-------
MIT, 2015.
.. |Build Status| image:: https://travis-ci.org/Miserlou/easy-expressions.svg
:target: https://travis-ci.org/Miserlou/easy-expressions
FAQs
Really, really easy regular expressions for python.
We found that easy-expressions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.