Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Regexp Builder Laravel Package

s9e/regexp-builder

Generate compact regular expressions that match a given list of strings (ideal for keyword search). Builds optimized patterns like ba[rz]|foo from input terms, with factories for PHP, Java, JavaScript, RE2, plus RawBytes/RawUTF8 output modes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic Validation & Parsing: Enables building regex patterns programmatically from user-provided data (e.g., input validation, search filters, or data sanitization) without hardcoding complex regex strings.
  • Reduced Technical Debt: Eliminates the need to manually craft and maintain regex logic, lowering the risk of errors in edge cases (e.g., special characters, Unicode, or locale-specific rules).
  • Scalable Rule Engine: Powers features like customizable search syntax (e.g., "find all emails matching *@domain.com"), fuzzy matching, or pattern-based data extraction (e.g., parsing unstructured logs).
  • Build vs. Buy: Justifies avoiding proprietary regex tools or custom development for regex-heavy workflows (e.g., compliance validation, NLP preprocessing).
  • Roadmap Prioritization: Accelerates delivery of:
    • User-facing validation (e.g., "allow only alphanumeric + hyphens").
    • Backend data processing (e.g., normalizing input for ML pipelines).
    • Admin tools (e.g., dynamic filtering in dashboards).

When to Consider This Package

  • Avoid if:
    • Your use case requires predefined, static regex (e.g., credit card validation with fixed patterns). Overkill for simple, known rules.
    • Performance is critical for high-throughput systems (e.g., real-time API rate limiting). Benchmark first—this library adds abstraction overhead.
    • Your team lacks PHP/Laravel expertise. Requires understanding of regex generation logic for debugging.
    • You need advanced regex features (e.g., lookbehinds, recursive patterns) not covered by the library’s DSL.
  • Look elsewhere if:
    • You’re using a language with built-in regex builders (e.g., Python’s regex library, JavaScript’s regexgen).
    • Your data is structured (use database queries or ORM filters instead).
    • Compliance requires auditable, human-readable regex (this generates opaque patterns).

How to Pitch It (Stakeholders)

For Executives: "This library lets us dynamically generate regex patterns from business rules—like a ‘fill-in-the-blank’ for validation or search. For example, instead of manually updating code when we add a new email domain to our allowlist, we configure it once and let the system handle the regex. This cuts dev time by 30% for features like custom input rules or log parsing, while reducing bugs from hardcoded regex. MIT-licensed and battle-tested, it’s a low-risk way to future-proof our data pipelines."

For Engineers: *"RegexpBuilder abstracts away the pain of crafting and maintaining complex regex strings. Key benefits:

  • DSL for regex: Define patterns in PHP (e.g., $builder->add('user_*@example.com')) instead of writing /^user_\w+@example\.com$/.
  • Unicode/locale support: Handles edge cases like accented characters or non-ASCII input out of the box.
  • Laravel-friendly: Integrates seamlessly with validation, form requests, or custom middleware. Tradeoff: Slightly higher memory usage for large pattern sets, but worth it for maintainability. Ideal for validation, search, or ETL workflows where rules evolve frequently."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php