Registry / http-networking / flpc
library0.2.5pypypi✓ verified 25d ago

flpc is a powerful Python library that wraps the blazing-fast Rust regex crate, bringing enhanced speed to your regular expression operations. It is designed to be a drop-in replacement for Python's native `re` module, with some minor syntax differences. Currently at version 0.2.5, it is in an experimental stage, meaning its code structure and dependencies may change, and users should be prepared for manual migrations to newer versions.

pip install flpc
INSTALL
IMPORT
SIG · FLPC
F
flpc
http-networkingpythonv0.2.5
Install
1.8s avg
Import
Disk
20MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.6s
py 3.11
✓ —
✓ 1.8s
py 3.12
✓ —
✓ 1.6s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 2s
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flpc
import flpc
import re
While designed as a replacement for Python's `re` module, you must import `flpc` directly.
fmatch
flpc.fmatch(pattern, string)
flpc.match(pattern, string)
The `match` function is renamed to `fmatch` to avoid conflicts with Python's keyword `match`.

This quickstart demonstrates basic usage of `flpc.search` for finding patterns anywhere in a string, `flpc.fmatch` for matching patterns only at the beginning of a string, and how to compile patterns for repeated use. It also highlights the use of `group(index)` for accessing captured groups.

import flpc # Using flpc.search text = "Hello world, hello Rust!" pattern = r"hello (\w+)" match_obj_search = flpc.search(pattern, text, flpc.IGNORECASE) if match_obj_search: print(f"Search found: {match_obj_search.group(0)}") # group(0) for entire match print(f"Captured group: {match_obj_search.group(1)}") else: print("No match found by search.") # Using flpc.fmatch (equivalent to re.match, matches only at the beginning) text_start = "Hello Python, hello flpc!" pattern_start = r"Hello (\w+)" match_obj_fmatch = flpc.fmatch(pattern_start, text_start) if match_obj_fmatch: print(f"fmatch found: {match_obj_fmatch.group(0)}") print(f"Captured group: {match_obj_fmatch.group(1)}") else: print("No match found by fmatch.") # Compile a pattern for efficiency compiled_pattern = flpc.compile(r"rust", flpc.IGNORECASE) match_compiled = compiled_pattern.search(text) if match_compiled: print(f"Compiled pattern search found: {match_compiled.group(0)}")
Debug
Known issues
breakingThe `match()` function from the standard `re` module is renamed to `fmatch()` in `flpc` to avoid conflict with Python's `match` keyword. Direct calls to `flpc.match()` will fail.
fix
Always use `flpc.fmatch()` instead of `flpc.match()`.
affects: All versions
breakingWhen accessing captured groups from a match object using `group()`, an index must always be provided (e.g., `group(0)` for the entire match, `group(1)` for the first captured group). Calling `group()` without an argument is not supported.
fix
Ensure an integer index is always passed to the `group()` method (e.g., `match_obj.group(0)`).
affects: All versions
gotchaThe `flpc` library is currently in an experimental stage. Its code structure and internal dependencies are subject to change, which may necessitate manual migrations for your project with future updates.
fix
Regularly consult the official GitHub repository and PyPI page for updates and potential migration instructions if you choose to use `flpc` in production environments.
affects: All versions (as of 0.2.5)
gotchaAlways check if a match object is returned (i.e., not `None`) before attempting to access its methods like `group()`, `start()`, or `end()`. Accessing methods on a `None` object will result in an `AttributeError`.
fix
Wrap access to match object methods within an `if match_obj:` block.
affects: All versions
gotchaWhile `flpc` aims to mirror the `re` module's API, it is not a complete, drop-in replacement. Minor behavioral differences or unimplemented functionalities compared to the standard `re` module might exist.
fix
Thoroughly test `flpc` with your specific regex patterns and use cases to ensure compatibility and expected behavior. Refer to the GitHub API section for known differences.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'flpc'
The 'flpc' library is not installed in the Python environment where the script is being executed.
fix
Install the 'flpc' package using pip: `pip install flpc`
AttributeError: module 'flpc' has no attribute 'match'
The 'flpc' library uses `fmatch()` instead of `match()` to avoid conflicts with Python keywords, but users migrating from the `re` module may attempt to use `flpc.match()`.
fix
Replace calls to `flpc.match()` with `flpc.fmatch()`.
AttributeError: 'NoneType' object has no attribute 'group' (or 'groupdict')
This error occurs when a regular expression search or match operation (e.g., `flpc.search()` or `flpc.fmatch()`) does not find a match in the input string, returning `None`, and a subsequent method like `group()` or `groupdict()` is called on this `None` object.
fix
Always check if a match object was returned (i.e., it's not `None`) before attempting to access its methods, for example: `match = flpc.fmatch(pattern, text); if match: print(match.group(0))`
TypeError: group() missing 1 required positional argument: 'index'
Unlike Python's native `re` module where `match_object.group()` can be called without arguments to return the entire match, `flpc`'s `group()` method explicitly requires an index argument.
fix
Always provide an index to the `group()` method (e.g., `match.group(0)` for the entire match or `match.group(1)` for the first captured group).
Upgrade
Version history
0.2.5latest on PyPI · released Jul 9, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
flpc — pip install flpc · libregistry