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

regex4seq

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regex4seq

Regular Expressions for Sequences of Things

  • 1.0.1
  • PyPI
  • Socket score

Maintainers
1

Welcome to RegEx4Seq

CircleCI Documentation Status

This is a python library that implements regular-expression based pattern matches for sequences of arbitrary objects. For example you can write pattern to determine if a list is a sequence of alternating 1's and 0's like this:

from regex4seq import Item, Items

# The core is a repetition of alternating 0s and 1s. But we need to
# account for the pattern starting on a 1 or finishing on a zero.
# Analogous to the regex /1?[01]*0?/.
pattern = Item(1).optional() & Items(0, 1).repeat() & Item(0).optional()

pattern.matches( [1, 0, 1, 0, 1, 0, 1])
# True

pattern.matches( [1, 0, 1, 0, 1, 0, 0])
# False

To learn more about the library, go to the documentation page on ReadTheDocs.

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