• This repository has been archived on 24/Dec/2021
  • Stars
    star
    386
  • Rank 107,246 (Top 3 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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
  26. ETHEREUM_HASH

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

More Repositories

1

awesomo

Cool open source projects. Choose your project and get involved in Open Source development now.
Go
9,188
star
2

mimesis

Mimesis is a powerful Python library that empowers developers to generate massive amounts of synthetic data efficiently.
Python
4,243
star
3

secrets.clj

A library designed to generate cryptographically strong random numbers suitable for managing data such as passwords, account authentication, security tokens, and related secrets.
Clojure
87
star
4

nebula

Small library for colored (ANSI) output in Erlang/Elixir/LFE. It's can be useful when you need to create user-friendly command-line applications.
Erlang
53
star
5

mimesis-factory

Mimesis integration with factory_boy
Python
52
star
6

macbook

A script for quickly setting up a development environment on the new Macbook.
Shell
47
star
7

rmanns

Remove annotations from the e-books downloaded from the pirate sites, such as www.it-ebooks.info, www.allitebooks.com and another ones.
Python
33
star
8

rkn-sosatb

Remove age verification system form PornHub for Russian users.
JavaScript
20
star
9

log4p

Log4j alternative for Python
Python
13
star
10

django-template

[WIP] A scaffold for all my Django projects.
Python
6
star
11

lk-geimfari.github.io

✍️ My personal blog, where I write my thoughts about software development etc.
CSS
5
star
12

spectet

Host availability monitoring utility that supports various protocols.
Go
3
star
13

mimety

Mimety is a tiny library for Elixir that help you handle mime types.
Elixir
2
star
14

tensorflow-censorship-categorization

2
star
15

parole

Simple and fast password manager based on gen_server and general balanced trees.
Erlang
1
star
16

hypeapp

Overhead shit that you don't need in your shitty project, but you have to use for hype.
1
star
17

gateway.tips

Gateway for crypto tip and donations.
Python
1
star
18

NFTISTA

NFT art generator which makes it easy to generate a combinations of unique images.
Python
1
star
19

healthy

Service for showing statuses of your services.
1
star
20

Factorial

Factorial brings the 2FA to the convenience of your CLI.
1
star
21

snippets

1
star
22

databank.clj

Simple in-memory database for Clojure.
Clojure
1
star