GithubHelp home page GithubHelp logo

itsmeadarsh2008 / flpc Goto Github PK

View Code? Open in Web Editor NEW
51.0 2.0 1.0 38 KB

A Rust-based regex crate wrapper for Python3 to get faster performance. ๐Ÿ‘พ

Home Page: https://pypi.org/project/flpc/

License: MIT License

Python 50.40% Rust 49.60%
maturin performance pyo3 python python3 regex regexp rust

flpc's Introduction

flpc logo

flpc: Lightning-Fast Python Regex

Star PyPI - Implementation GitHub Issues PyPI - Downloads GitHub License GitHub last commit

๐Ÿš€ Supercharge your Python regex with Rust-powered performance!

๐ŸŒŸ Why flpc?

Being in experimental stage. The code structure and dependencies may change. If your project is using this. You will have to manually configure the migrations to latest versions.

flpc is a powerful Python library that wraps the blazing-fast Rust regex crate, bringing enhanced speed to your regular expression operations. It's designed to be a drop-in replacement for Python's native re module, with some minor syntax differences.

๐Ÿš€ Quick Start

  1. Install flpc:

    pip install flpc
    
  2. Use it in your code as shown in the API

๐Ÿ”ง API

flpc mirrors the re module's API, with a few small exceptions:

  • Use fmatch() instead of match() (to avoid conflicts with Python's keyword)
  • When using group() on a match object, always provide an index (e.g., group(0) for the entire match)

Common functions include:

  • compile()
  • search()
  • findall()
  • finditer()
  • split()
  • sub()
  • subn()

๐Ÿ’ก Pro Tips

  • Pre-compile your patterns for faster execution
  • Use raw strings (r'') for cleaner regex patterns
  • Always check if a match is found before accessing groups
  • Remember to use group(0) to get the entire match

๐Ÿค Contributing

We welcome contributions! Whether it's bug reports, feature requests, or code contributions, please feel free to reach out. Check our contribution guidelines to get started.

๐Ÿ“„ License

flpc is open-source software licensed under the MIT license.

flpc's People

Contributors

itsmeadarsh2008 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bopo

flpc's Issues

Unexpected error in version 0.2.4

I just upgraded flpc from 0.2.1 to 0.2.4 in my python 3.11 environment and for this code:

text = "The fox jumps over the dog. Poor dog!"
pattern = flpc.compile(r'(\s|.|!)', flags=0)
matches_iter = flpc.finditer(pattern, text)
for match in matches_iter:
span_start = match.start(0)
span_end = match.end(0)
print(span_start, span_end)

I know get an error message:

PanicException Traceback (most recent call last)
Cell In [17], line 5
3 matches_iter = flpc.finditer(pattern, text)
4 for match in matches_iter:
----> 5 span_start = match.start(0)
6 span_end = match.end(0)
7 print(span_start, span_end)

PanicException: byte index 3 is out of bounds of

If I go back to 0.2.1 it's fine. Is there a dependency on my side I am not aware of?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.