Skip to main content

Find all dates, times, emails, phone numbers, links, emails, ip addresses, and prices in a string.

Project description

Find all times, dates, links, phone numbers, emails, ip addresses, and prices in a string.

Usage

>>> from commonregex import CommonRegex
>>> parsed_text = CommonRegex("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-2723 or get in touch with
                               my associate at harold.smith@gmail.com")
>>> parsed_text.times
['5:00PM', '4:00']
>>> parsed_text.dates
['Jan 9th 2012']
>>> parsed_text.links
['www.linkedin.com']
>>> parsed_text.phones
['(519)-236-2727']
>>> parsed_text.emails
['harold.smith@gmail.com']

Alternatively, you can generate a single CommonRegex instance and use it to parse multiple segments of text.

>>> parser = CommonRegex()
>>> parser.times("When are you free?  Do you want to meet up for coffee at 4:00?")
['4:00']

Please note that this module is currently English/US specific.

CommonRegex Ports:

[CommonRegexJS] (https://github.com/talyssonoc/CommonRegexJS)

[CommonRegexScala] (https://github.com/everpeace/CommonRegexScala)

[CommonRegexJava] (https://github.com/talyssonoc/CommonRegexJava)

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

commonregex-1.0.tar.gz (1.4 kB view details)

Uploaded Source

File details

Details for the file commonregex-1.0.tar.gz.

File metadata

  • Download URL: commonregex-1.0.tar.gz
  • Upload date:
  • Size: 1.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for commonregex-1.0.tar.gz
Algorithm Hash digest
SHA256 601c9209f1436618f0f8975a7bc8de8a8d4fe5695821f65df865a121983acc9d
MD5 a7680c3f7c742ac36a7e0e8856152dae
BLAKE2b-256 4f357844a66f5507f7a7c4637f9b2c46960a85f8ee4fb0e7e99c8c54fa932092

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page