Python cli tool to redact sensitive data
Project description
CommonRegex Improved
An improved version of commonly used regular expressions in Python
Inspired by and improved upon CommonRegex
This is a collection of commonly used regular expressions. This library provides a simple API interface to match the strings corresponding to specified patterns.
Installation
pip install --upgrade commonregex-improved
Usage
import commonregex_improved as CommonRegex
text = "John, please get that article on www.linkedin.com to me by 5:00PM on Jan 9th 2012. 4:00 would be ideal, actually. If you have any questions, You can reach me at (519)-236-2723x341 or get in touch with my associate at harold.smith@gmail.com. You can find my ip address at 127.0.0.1 or at 64.248.67.225. I also have a secret protected with md5 8a2292371ee60f8212096c06fe3335fd"
date_list = CommonRegex.dates(text)
# ['Jan 9th 2012']
time_list = CommonRegex.times(text)
# ['5:00PM', '4:00']
url_list = CommonRegex.links(text)
# ['www.linkedin.com', 'harold.smith@gmail.com']
phone_list = CommonRegex.phones_with_exts(text)
# ['(519)-236-2723x341']
email_list = CommonRegex.emails(text)
# ['harold.smith@gmail.com']
md5_list = CommonRegex.md5_hashes(text)
# ['8a2292371ee60f8212096c06fe3335fd']
⚔️ Performance benchmark
CommonRegex is awesome!
So why re-implement the popular original commonregex project? The API calls to each of the regular expressions are really slow.
It takes 12 seconds for a total of 2999 calls to Dates function in the original version of CommonRegex. While the improved version of CommonRegex with the same number of calls merely takes 2 seconds.
You can find more detailed results about original and improved versions.
Features / Supported Methods
dates(text: str)
times(text: str)
phones(text: str)
phones_with_exts(text: str)
links(text: str)
emails(text: str)
ipv4s(text: str)
ipv6s(text: str)
ips(text: str)
not_known_ports(text: str)
prices(text: str)
hex_colors(text: str)
credit_cards(text: str)
visa_cards(text: str)
master_cards(text: str)
btc_address(text: str)
street_addresses(text: str)
zip_codes(text: str)
po_boxes(text: str)
ssn_numbers(text: str)
md5_hashes(text: str)
sha1_hashes(text: str)
sha256_hashes(text: str)
isbn13s(text: str)
isbn10s(text: str)
mac_addresses(text: str)
iban_numbers(text: str)
git_repos(text: str)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for commonregex-improved-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfa8c303ef19dd256e7a4c8bc23f1a249c503bb9cf388f4c11768ec7da209686 |
|
MD5 | 579d7bcb17beec784a4f7fa8ecbe8e31 |
|
BLAKE2b-256 | e297567c370e9844707f7b1e75b3e856ba3081a05bc20c1ef839970d3d3a79dd |
Hashes for commonregex_improved-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c10c0536303c60e537b80722768d658fd43171bb08f777cad49bea88ef59086 |
|
MD5 | 66276aede4cf9349b4d6af0c290431e2 |
|
BLAKE2b-256 | 9542d7a321a3b29201f5e56363a8100de220bfe279153b8a8b9bceca97f3ce57 |