expynent

Library that provides RegEx patterns.


Keywords
regex, py, expynent, patterns, compiled, lib, regex-pattern, test, testing
License
BSD-3-Clause
Install
pip install expynent==1.0.0

Documentation

Expynent

Build Status codecov PyPI version

Expynent is a tiny library that provides regular expression patterns. This can be useful if you don't want to write regular expression manually. Also you can use this library as fixture for testing framework like a py.test.

Docs

This is a really tiny library and here no need for the documentation. Just import pattern and use it! May the force be with you.

Installation

~ git clone https://github.com/lk-geimfari/expynent.git
➜  ~ cd expynent/
➜  ~ python setup.py install

or

~  pip install expynent

Usage

Just import the pattern that you want:

import re
import expynent.patterns as expas

if re.match(expas.ZIP_CODE['RU'], '43134'):
    print('match')
else:
    print('not match')
    
# Output: 'not match'

also you can use compiled patterns:

from expynent.compiled import URL

url = 'http://foo.com/blah_blah_(wikipedia)_(again)'

if URL.match(url):
    print('valid')
else:
    print('invalid')
    
# Output: 'valid'

Supported patterns

You can look at the list of supported patterns below:

  1. BITCOIN_ADDRESS
  2. CREDIT_CARD
  3. CREDIT_CARD_STRICT
  4. EMAIL_ADDRESS
  5. ETHEREUM_ADDRESS
  6. FLOAT_NUMBER
  7. HEX_VALUE
  8. IP_V4
  9. IP_V6
  10. IRC
  11. ISBN
  12. ISO_8601_DATETIME
  13. LATITUDE
  14. LICENSE_PLATE
  15. LONGITUDE
  16. MAC_ADDRESS
  17. PHONE_NUMBER
  18. ROMAN_NUMERALS
  19. SLUG
  20. TIME_24H_FORMAT
  21. URL
  22. UUID
  23. YANDEX_MONEY
  24. ZIP_CODE

Contributing

Your contributions are always welcome! Please take a look at the contribution guidelines first.

Attention

This is an experimental project and it's mean that we do not guarantee stability. We try to write tests for all expressions, but we cannot guarantee the perfect operation of regular expressions because it is impossible to cover all cases.

Licence

BSD 3-Clause License