{"id":13896627,"url":"https://github.com/daurnimator/lpeg_patterns","last_synced_at":"2025-10-10T01:33:34.082Z","repository":{"id":2933385,"uuid":"30002176","full_name":"daurnimator/lpeg_patterns","owner":"daurnimator","description":"A collection of LPEG patterns","archived":false,"fork":false,"pushed_at":"2022-05-23T14:28:11.000Z","size":338,"stargazers_count":128,"open_issues_count":9,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-10T01:33:08.464Z","etag":null,"topics":["lpeg","lua","parser","uri","uri-parser","url"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daurnimator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-29T03:40:41.000Z","updated_at":"2025-09-02T01:51:09.000Z","dependencies_parsed_at":"2022-08-18T15:37:14.603Z","dependency_job_id":null,"html_url":"https://github.com/daurnimator/lpeg_patterns","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/daurnimator/lpeg_patterns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daurnimator%2Flpeg_patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daurnimator%2Flpeg_patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daurnimator%2Flpeg_patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daurnimator%2Flpeg_patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daurnimator","download_url":"https://codeload.github.com/daurnimator/lpeg_patterns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daurnimator%2Flpeg_patterns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002405,"owners_count":26083374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lpeg","lua","parser","uri","uri-parser","url"],"created_at":"2024-08-06T18:03:02.826Z","updated_at":"2025-10-10T01:33:34.056Z","avatar_url":"https://github.com/daurnimator.png","language":"Lua","readme":"A collection of [LPEG](http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html) patterns\n\n## Use cases\n\n  - Strict validation of user input\n  - Searching free-form input\n\n\n## Modules\n\n### `core`\n\nA small module implementing commonly used rules from [RFC-5234 appendix B.1](https://tools.ietf.org/html/rfc5234#appendix-B.1)\n\n  - `ALPHA` (pattern)\n  - `BIT` (pattern)\n  - `CHAR` (pattern)\n  - `CR` (pattern)\n  - `CRLF` (pattern)\n  - `CTL` (pattern)\n  - `DIGIT` (pattern)\n  - `DQUOTE` (pattern)\n  - `HEXDIG` (pattern)\n  - `HTAB` (pattern)\n  - `LF` (pattern)\n  - `LWSP` (pattern)\n  - `OCTET` (pattern)\n  - `SP` (pattern)\n  - `VCHAR` (pattern)\n  - `WSP` (pattern)\n\n\n### `IPv4`\n\n  - `IPv4address` (pattern): parses an IPv4 address in dotted decimal notation. on success, returns addresses as an IPv4 object\n  - `IPv4_methods` (table):\n      - `unpack` (function): the IPv4 address as a series of 4 8 bit numbers\n      - `binary` (function): the IPv4 address as a 4 byte binary string\n  - `IPv4_mt` (table): metatable given to IPv4 objects\n      - `__index` (table): `IPv4_methods`\n      - `__tostring` (function): returns the IPv4 address in dotted decimal notation\n\nIPv4 \"dotted decimal notation\" in this document refers to \"strict\" form (see [RFC-6943 section 3.1.1](https://tools.ietf.org/html/rfc6943#section-3.1.1)) unless otherwise noted.\n\n\n### `IPv6`\n\n  - `IPv6address` (pattern): parses an IPv6 address\n  - `IPv6addrz` (pattern): parses an IPv6 address with optional \"ZoneID\" (see [RFC-6874](https://tools.ietf.org/html/rfc6874))\n  - `IPv6_methods` (table): methods available on IPv6 objects\n      - `unpack` (function): the IPv6 address as a series of 8 16bit numbers, optionally followed by zoneid\n      - `binary` (function): the IPv6 address as a 16 byte binary string\n      - `setzoneid` (function): set the zoneid of this IPv6 address\n  - `IPv6_mt` (table): metatable given to IPv6 objects\n      - `__tostring` (function): will return the IPv6 address as a valid IPv6 string\n\n\n### `uri`\n\nParses URIs as described in [RFC-3986](https://tools.ietf.org/html/rfc3986).\n\n  - `uri` (pattern): on success, returns a table with fields: (similar to [luasocket](http://w3.impa.br/~diego/software/luasocket/url.html#parse))\n      - `scheme`\n      - `userinfo`\n      - `host`\n      - `port`\n      - `path`\n      - `query`\n      - `fragment`\n  - `absolute_uri` (pattern): similar to `uri`, but does not permit fragments\n  - `uri_reference` (pattern): similar to `uri`, but permits relative URIs\n  - `relative_part` (pattern): matches a relative uri not including query and fragment; data is held in named group captures `\"userinfo\"`, `\"host\"`, `\"port\"`, `\"path\"`\n  - `scheme` (pattern): matches the scheme portion of a URI\n  - `userinfo` (pattern): matches the userinfo portion of a URI\n  - `host` (pattern): matches the host portion of a URI\n  - `IP_literal` (pattern): matches an IP based host portion of a URI. Capture is an [IPv4](#IPv4), [IPv6](#IPv6) or IPvFuture object\n  - `port` (pattern): matches the port portion of a URI\n  - `authority` (pattern): matches the authority portion of a URI; data is held in named group captures of `\"userinfo\"`, `\"host\"`, `\"port\"`\n  - `path` (pattern): matches the path portion of a URI. Captures `nil` for the empty path.\n  - `segment` (pattern): matches a path segment (a piece of a path without a `/`)\n  - `query` (pattern): matches the query portion of a URI\n  - `fragment` (pattern): matches the fragment portion of a URI\n  - `sane_uri` (pattern): a variant that shouldn't match things that people would not normally consider URIs.\n    e.g. uris without a hostname\n  - `sane_host` (pattern): a variant that shouldn't match things that people would not normally consider valid hosts.\n  - `sane_authority` (pattern): a variant that shouldn't match things that people would not normally consider valid hosts.\n  - `pct_encoded` (pattern): matches a percent encoded octet, produces a capture of the normalised form.\n  - `sub_delims` (pattern): the set of subcomponent delimeters\n\n\n### `email`\n\n  - `mailbox` (pattern): the mailbox format: matches either `name_addr` or an addr-spec.\n  - `name_addr` (pattern): the name and address format i.e. `Display Name\u003cemail@example.com\u003e`\n    Has captures of the local_part and the domain. Captures the display name in the named capture `\"display\"`\n  - `email` (pattern): also known as an \"addr-spec\"; follows [RFC-5322 section 3.4.1](http://tools.ietf.org/html/rfc5322#section-3.4.1)\n    Has captures of the local_part and the domain\n    Be careful trying to reconstruct the email address from the captures; you may need escaping\n  - `local_part` (pattern): the bit before the `@` in an email address\n  - `domain` (pattern): the bit after the `@` in an email address\n  - `email_nocfws` (pattern): a variant that doesn't allow for comments or folding whitespace\n  - `local_part_nocfws` (pattern): the bit before the `@` in an email address; no comments or folding whitespace allowed.\n  - `domain_nocfws` (pattern):  the bit after the `@` in an email address; no comments or folding whitespace allowed.\n\n\n### `http`\n\nThese patterns should be considered to have non stable APIs.\n\n#### [RFC 4918](https://tools.ietf.org/html/rfc4918)\n\n  - `DAV` (pattern)\n  - `Depth` (pattern)\n  - `Destination` (pattern)\n  - `If` (pattern)\n  - `Lock_Token` (pattern)\n  - `Overwrite` (pattern)\n  - `TimeOut` (pattern)\n\n\n#### [RFC 5023](https://tools.ietf.org/html/rfc5023)\n\n  - `SLUG` (pattern)\n\n\n#### [RFC 5323](https://tools.ietf.org/html/rfc5323)\n\n  - `DASL` (pattern)\n\n\n#### [RFC 5789](https://tools.ietf.org/html/rfc5789)\n\n  - `Accept_Patch` (pattern)\n\n\n#### [RFC 5988](https://tools.ietf.org/html/rfc5988)\n\n  - `Link` (pattern)\n\n\n#### [RFC 6265](https://tools.ietf.org/html/rfc6265)\n\n  - `Set_Cookie` (pattern)\n  - `Cookie` (pattern)\n\n\n#### [RFC 6266](https://tools.ietf.org/html/rfc6266)\n\n  - `Content_Disposition` (pattern)\n\n\n#### [RFC 6454](https://tools.ietf.org/html/rfc6454)\n\n  - `Origin` (pattern)\n\n\n#### [RFC 6455](https://tools.ietf.org/html/rfc6455)\n\n  - `Sec_WebSocket_Accept` (pattern)\n  - `Sec_WebSocket_Key` (pattern)\n  - `Sec_WebSocket_Extensions` (pattern)\n  - `Sec_WebSocket_Protocol_Client` (pattern)\n  - `Sec_WebSocket_Protocol_Server` (pattern)\n  - `Sec_WebSocket_Version_Client` (pattern)\n  - `Sec_WebSocket_Version_Server` (pattern)\n\n\n#### [RFC 6638](https://tools.ietf.org/html/rfc6638)\n\n  - `Schedule_Reply` (pattern)\n  - `Schedule_Tag` (pattern)\n  - `If_Schedule_Tag_Match` (pattern)\n\n\n#### [RFC 6797](https://tools.ietf.org/html/rfc6797)\n\n  - `Strict_Transport_Security` (pattern)\n\n\n#### [RFC 7034](https://tools.ietf.org/html/rfc7034)\n\n  - `X_Frame_Options` (pattern)\n\n\n#### [RFC 7089](https://tools.ietf.org/html/rfc7089)\n\n  - `Accept_Datetime` (pattern)\n  - `Memento_Datetime` (pattern)\n\n\n#### [RFC 7230](https://tools.ietf.org/html/rfc7230)\n\n  - `request_line` (pattern)\n  - `field_name` (pattern)\n  - `field_value` (pattern)\n  - `header_field` (pattern)\n  - `OWS` (pattern)\n  - `RWS` (pattern)\n  - `BWS` (pattern)\n  - `token` (pattern)\n  - `qdtext` (pattern)\n  - `quoted_string` (pattern)\n  - `comment` (pattern)\n  - `Content_Length` (pattern)\n  - `Transfer_Encoding` (pattern)\n  - `chunk_ext` (pattern)\n  - `TE` (pattern)\n  - `Trailer` (pattern)\n  - `request_target` (pattern)\n  - `Host` (pattern)\n  - `Via` (pattern): captures are a list of tables with fields `.protocol`, `.by` and `.comment`\n  - `Connection` (pattern)\n  - `Upgrade` (pattern): captures are a list of strings containing *protocol* or *protocol/version*\n\n\n#### [RFC 7231](https://tools.ietf.org/html/rfc7231)\n\n  - `IMF_fixdate` (pattern)\n  - `Content_Encoding` (pattern)\n  - `Content_Type` (pattern)\n  - `Content_Language` (pattern)\n  - `Content_Location` (pattern)\n  - `Expect` (pattern)\n  - `Max_Forwards` (pattern)\n  - `Accept` (pattern)\n  - `Accept_Charset` (pattern)\n  - `Accept_Encoding` (pattern)\n  - `Accept_Language` (pattern)\n  - `From` (pattern)\n  - `Referer` (pattern)\n  - `User_Agent` (pattern)\n  - `Date` (pattern): capture is a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n  - `Location` (pattern)\n  - `Retry_After` (pattern): capture is either a table describing an absolute time in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time), or a relative time as a number of seconds\n  - `Vary` (pattern)\n  - `Allow` (pattern)\n  - `Server` (pattern)\n\n\n#### [RFC 7232](https://tools.ietf.org/html/rfc7232)\n\n  - `Last_Modified` (pattern): capture is a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n  - `ETag` (pattern)\n  - `If_Match` (pattern)\n  - `If_None_Match` (pattern)\n  - `If_Modified_Since` (pattern): capture is a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n  - `If_Unmodified_Since` (pattern): capture is a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n\n\n#### [RFC 7233](https://tools.ietf.org/html/rfc7233)\n\n  - `Accept_Ranges` (pattern)\n  - `Range` (pattern)\n  - `If_Range` (pattern): capture is either an `entity_tag` or a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n  - `Content_Range` (pattern)\n\n\n#### [RFC 7234](https://tools.ietf.org/html/rfc7234)\n\n  - `Age` (pattern)\n  - `Cache_Control` (pattern): captures are grouped into key/value pairs (where a directive with no value has a value of `true`)\n  - `Expires` (pattern): capture is a table in the same format as used by [`os.time`](http://www.lua.org/manual/5.3/manual.html#pdf-os.time)\n  - `Pragma` (pattern)\n  - `Warning` (pattern)\n\n\n#### [RFC 7235](https://tools.ietf.org/html/rfc7235)\n\n  - `WWW_Authenticate` (pattern)\n  - `Authorization` (pattern)\n  - `Proxy_Authenticate` (pattern)\n  - `Proxy_Authorization` (pattern)\n\n\n#### [RFC 7239](https://tools.ietf.org/html/rfc7239)\n\n  - `Forwarded` (pattern)\n\n\n#### [RFC 7469](https://tools.ietf.org/html/rfc7469)\n\n  - `Public_Key_Pins` (pattern)\n  - `Public_Key_Pins_Report_Only` (pattern)\n\n\n#### [RFC 7486](https://tools.ietf.org/html/rfc7486)\n\n  - `Hobareg` (pattern)\n\n\n#### [RFC 7615](https://tools.ietf.org/html/rfc7615)\n\n  - `Authentication_Info` (pattern)\n  - `Proxy_Authentication_Info` (pattern)\n\n\n#### [RFC 7639](https://tools.ietf.org/html/rfc7639)\n\n  - `ALPN` (pattern)\n\n\n#### [RFC 7809](https://tools.ietf.org/html/rfc7809)\n\n  - `CalDAV_Timezones` (pattern)\n\n\n#### [RFC 7838](https://tools.ietf.org/html/rfc7838)\n\n  - `Alt_Svc` (pattern)\n  - `Alt_Used` (pattern)\n\n\n#### [Expect-CT Extension for HTTP](https://tools.ietf.org/html/draft-ietf-httpbis-expect-ct-06)\n\n  - `Expect_CT` (pattern)\n\n\n#### [Referrer-Policy header](https://www.w3.org/TR/referrer-policy/#referrer-policy-header)\n\n  - `Referrer_Policy` (pattern)\n\n\n### `phone`\n\n  - `phone` (pattern): includes detailed checking for:\n      - USA phone numbers using the [NANP](https://en.wikipedia.org/wiki/North_American_Numbering_Plan)\n\n\n### `language`\n\nPatterns for definitions from [RFC-4646 Section 2.1](https://tools.ietf.org/html/rfc4646#section-2.1)\n\n  - `langtag` (pattern): Capture is a table with the language tag decomposed into components:\n      - `language`\n      - `extlang` (optional)\n      - `script` (optional)\n      - `region` (optional)\n      - `variant` (optional): an array\n      - `extension` (optional): a dictionary from singleton to value\n      - `privateuse` (optional): an array\n  - `privateuse` (pattern): captures an array\n  - `Language_Tag` (pattern): captures the whole language tag\n","funding_links":[],"categories":["Lua","Resources"],"sub_categories":["Libraries","Parsing and Serialization"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaurnimator%2Flpeg_patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaurnimator%2Flpeg_patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaurnimator%2Flpeg_patterns/lists"}