Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyrematch

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyrematch

Python bindings for REmatch, an information extraction focused regex library that uses constant delay algoirthms

  • 1.1.4
  • PyPI
  • Socket score

Maintainers
3

REmatch

PyREmatch: REmatch bindings for Python

Python bindings for REmatch, an information extraction focused regex library that uses constant delay algorithms.

  • REmatch's Official Website
  • GitHub Repository
  • PyREmatch Tutorial

Installation

You can install the latest release version from PyPI:

pip install pyrematch

Or you can build from the source code:

git clone git@github.com:REmatchChile/REmatch.git
cd REmatch
pip install .

Usage

Here is an example that prints all the matches using the finditer function.

import pyrematch as REmatch

# Define the document and the REQL pattern
document = "cperez@gmail.com\npvergara@ing.uc.cl\njuansoto@uc.cl"
pattern = r"@!domain{(\w+\.)+\w+}(\n|$)"

# Create a REQL query
query = REmatch.reql(pattern)

# Execute the query and print the results
for match in query.finditer(document):
    print(match)

The Query object contains also other useful methods. To get a single match, you can use:

query.findone(document)

To find all the matches, you can use:

query.findall(document)

To find a limited number of matches, you can use:

limit = 10
query.findmany(document, limit)

To check if a match exists, you can use:

query.check(document)

You can read more about this in the PyREmatch Tutorial.

Keywords

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc