Coder Social home page Coder Social logo

nikitagashkov / expynent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lk-geimfari/expynent

0.0 1.0 0.0 220 KB

A library that provides regular expression patterns. If you hate to write regular expressions, then expynent can help you.

Home Page: http://expynent.rtfd.io

License: BSD 3-Clause "New" or "Revised" License

Python 99.85% Makefile 0.15%

expynent's Introduction

Expynent - Common Regular Expression

Build Status codecov PyPI version

Expynent is a tiny library that provides common 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.

Installation

 ~  pip install expynent

Usage

Just import the pattern that you want:

import re
from expynent.patterns import ZIP_CODE

if re.match(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. PGP_FINGERPRINT
  18. PHONE_NUMBER
  19. ROMAN_NUMERALS
  20. SLUG
  21. TIME_24H_FORMAT
  22. URL
  23. UUID
  24. YANDEX_MONEY
  25. 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.