A collection of LPEG patterns for parsing and validating common data formats like URIs, emails, IP addresses, and HTTP headers.
lpeg_patterns is a Lua library providing a collection of LPEG patterns for parsing and validating common data formats. It solves the problem of implementing correct parsers for standards like URIs, emails, IP addresses, and HTTP headers by offering pre-built, RFC-compliant patterns.
Lua developers working with network protocols, data validation, or text processing who need reliable parsing of standardized formats without writing complex grammars.
Developers choose lpeg_patterns because it provides rigorously tested, specification-compliant patterns that are ready to use, reducing implementation errors and saving development time compared to writing custom parsers.
A collection of LPEG patterns
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements patterns for standards like URIs (RFC 3986), emails (RFC 5322), and IP addresses, ensuring correctness and adherence to official specifications without manual implementation.
Parses data into organized Lua tables, such as URI components or IPv4 objects, making it easy to access and manipulate parsed information programmatically.
Organized into modules like uri, email, and http, allowing developers to import only needed patterns, reducing code bloat and improving maintainability.
Includes patterns like 'sane_uri' that exclude rare edge cases, providing more practical validation for common use cases while maintaining correctness.
The HTTP module patterns are explicitly marked as having non-stable APIs, meaning they could change and break existing code in future updates, posing a risk for production use.
Requires familiarity with LPEG, which has a steeper learning curve compared to simpler Lua string patterns or regex, potentially increasing initial setup time.
Focuses solely on RFC-based formats; for custom or niche data parsing, developers must still write their own LPEG patterns, offering no out-of-the-box support.