Skip to main content

Zero-dependency text search and extraction: codes, links, regex

Project description

textseek

English | Русский

Zero-dependency Python library for searching and extracting structured data — confirmation codes, links, and arbitrary regex matches — from plain text.

textseek is not tied to any source: the text may come from email, SMS, HTML, an API response, logs, OCR, or anywhere else. Fetching text is your job; pulling structured values out of it is textseek's.

Install

pip install textseek

Requires Python 3.12+. No runtime dependencies.

Quickstart

from textseek import TextSeek, Extract

text = "Your verification code is 123456"

seek = TextSeek(text)
result = seek.extract_one(Extract.code(length=6, digits=True))

print(result.value)  # 123456

Extract a link and inspect its parts

link = TextSeek(text).extract_one(
    Extract.link(domain="example.com")
)
print(link.domain)              # example.com
print(link.path)                # /auth/magic
print(link.query_params["token"][0])

Find by example link

link = TextSeek(text).extract_one(
    Extract.link(sample="https://example.com/auth/magic?token=abc&email=test@example.com")
)

Arbitrary regex

order = TextSeek(text).extract_one(Extract.regex(r"Order ID:\s*([A-Z0-9\-]+)"))
print(order.value)

Methods

Method Returns
extract_one(spec) one result, or raises ExtractNotFoundError
extract_first(spec) first result, or None
extract_all(spec) list of results (possibly empty)
contains(spec) bool

See full documentation in docs/.

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

textseek-0.1.0.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textseek-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file textseek-0.1.0.tar.gz.

File metadata

  • Download URL: textseek-0.1.0.tar.gz
  • Upload date:
  • Size: 50.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for textseek-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2144923ff7a88d0cbbc8f6c983c5964f0da21a3d00bd7efae7a9ac6d8aad338
MD5 6ce477b6158619cf83a06a22077de551
BLAKE2b-256 e4e19c03818cfc17460bc1236d8676a936a77c31263c829ffa313643508250c2

See more details on using hashes here.

File details

Details for the file textseek-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: textseek-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for textseek-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d98f0abdb81d8aa6f09628cff34ed0b2566a8eb4130390b85a57422bef794366
MD5 1beeb30fc4738fca5c8c4bc17920200f
BLAKE2b-256 b22cae2a39680f7193fca4a243bfed7ff213745e1bdf2650da02b78307979b32

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