{"id":19836940,"url":"https://github.com/orbitalquark/lua-std-regex","last_synced_at":"2026-02-13T02:03:07.757Z","repository":{"id":177607136,"uuid":"648834170","full_name":"orbitalquark/lua-std-regex","owner":"orbitalquark","description":"A simple Lua wrapper around C++11's regex capabilities to implement regex versions of Lua's string library pattern matching routines","archived":false,"fork":false,"pushed_at":"2025-01-01T15:25:36.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"default","last_synced_at":"2025-01-01T16:30:15.250Z","etag":null,"topics":["lua","regex","regexp"],"latest_commit_sha":null,"homepage":"","language":"C++","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/orbitalquark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-03T00:09:14.000Z","updated_at":"2025-01-01T15:25:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"83d4c17c-1416-49b2-ad0e-700edc6843ae","html_url":"https://github.com/orbitalquark/lua-std-regex","commit_stats":null,"previous_names":["orbitalquark/lua-std-regex"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitalquark%2Flua-std-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitalquark%2Flua-std-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitalquark%2Flua-std-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitalquark%2Flua-std-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orbitalquark","download_url":"https://codeload.github.com/orbitalquark/lua-std-regex/tar.gz/refs/heads/default","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233472452,"owners_count":18681402,"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","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":["lua","regex","regexp"],"created_at":"2024-11-12T12:13:04.729Z","updated_at":"2025-09-18T10:33:01.471Z","avatar_url":"https://github.com/orbitalquark.png","language":"C++","readme":"# Lua-std-regex\n\nThis is a simple Lua module that wraps C++11's regular expression (regex) capabilities to implement\nregex versions of Lua's `string.find()`, `string.gmatch()`, `string.gsub()`, and `string.match()`.\n\nIt only requires a C++ compiler and runtime that support's the C++11 standard's regex features.\n\n## Compiling\n\nThere is a simple Makefile that builds a *regex.so* shared library on Linux by running\n`make`. You can also include *lregex.h* and/or *lregex.cpp* in your Lua-scripted application's\nbuild system. `luaopen_regex` is the module's C entry point.\n\n## Documentation\n\n- `regex.find(s, re[, init=1])`: Searches string *s* for regex string *re* starting at position\n*init*, and returns the start and end positions of the match followed by any string values\ncaptured by *re*. Returns `nil` if no match was found.\n\n- `regex.gmatch(s, re[, init=1])`: Returns an iterator that can be used in a `for` loop to iterate\nover all occurrences of regex string *re* in string *s* starting at position *init*. If *re* has\ncaptures, the captured values are assigned to loop variables. Otherwise, the entire match is used.\n\n- `regex.gsub(s, re, replacement[, n=0])`: Returns a copy of string *s* where all (or the first\n*n*) instances of regex string *re* are replaced by string *replacement*, and also returns the\nnumber of replacements made. *replacement* may contain \"$*d*\" sequences, which represent the\n*d*-th value captured by *re*. *replacement* may also be a table or function. If it is a table,\nand the match or first capture exists as a key, that key's value is the replacement text. If\n*replacement* is a function, that function is called with either the captured values or the\nentire match as arguments.  If the function returns a string or number, that result is the\nreplacement text.\n\n- `regex.match(s, re[, init=1])`: Searches string *s* for regex string *re* starting at position\n*init*, and returns either the values captured by *re* or the entire match itself. Returns\n`nil` if no match was found.\n\n## Usage\n\n```\nLua 5.4.4  Copyright (C) 1994-2022 Lua.org, PUC-Rio\n\u003e re = require('regex')\n\u003e re.find('foo', 'o')\n2\t2\n\u003e for char in re.gmatch('foo', '.', 2) do print(char) end\no\no\n\u003e re.gsub('foo', '.', string.upper, 1)\nFoo\t1\n\u003e re.match('foo', 'fo+')\nfoo\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitalquark%2Flua-std-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forbitalquark%2Flua-std-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitalquark%2Flua-std-regex/lists"}