You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

treg

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treg

treg utilizes trie structured regex patterns to search texts for a potientially large number of words and phrases.

0.0.3
pipPyPI
Maintainers
1

treg 0.0.3

treg utilizes trie structured regex patterns to search texts for a potientially large number of words and phrases.

Experimental state

This project is in an early and experimental state and might be subject substantial changes in the future.

Documentation

Documentation is available at https://treg.readthedocs.io

Getting started

from treg import Treg, Phrase, Match

# Initialize a new pattern
treg = Treg()
# Add some phrases
treg.add_phrases([
    Phrase(phrase='afternoon tea', meta={'fun': 1}),
    Phrase(phrase='tea party', meta={'fun': 3}),
    # ...
])
# Compile the pattern
treg.compile()
# Happy searching!
for match in treg.find_iter(
        "A long collection of afternoon tea party recipes ...",
        overlapped=True):
    print(match)

# Output
Match(phrases=[Phrase(phrase='afternoon tea', meta={'fun': 1})], start=16, end=29)
Match(phrases=[Phrase(phrase='tea party', meta={'fun': 3})], start=26, end=35)

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.