Metadata-Version: 2.4
Name: textseek
Version: 0.1.0
Summary: Zero-dependency text search and extraction: codes, links, regex
Project-URL: Homepage, https://github.com/0cherednoq/teetseek
Project-URL: Repository, https://github.com/0cherednoq/teetseek
Project-URL: Issues, https://github.com/0cherednoq/teetseek/issues
Author: 0cherednoq
License: MIT
License-File: LICENSE
Keywords: extraction,links,otp,parsing,regex,text,verification-code
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing
Classifier: Typing :: Typed
Requires-Python: >=3.12
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# textseek

**English** | [Русский](README.ru.md)

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

```bash
pip install textseek
```

Requires Python 3.12+. No runtime dependencies.

## Quickstart

```python
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

```python
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

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

### Arbitrary regex

```python
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/`.
